LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-17-2004, 02:26 PM   #1
Umek
LQ Newbie
 
Registered: Mar 2004
Posts: 10

Rep: Reputation: 0
Piping password to sudo


Hello,

I'm trying to use sudo in order to run something as root.
I'm piping my password to the sudo using "echo" like this:

echo 'mypass' | sudo -u root -S touch testfile

but it doesn't work, I'm getting this:

Password:
Sorry, try again.
Password:
sudo: 1 incorrect password attempt

Does anyone know what I'm doing wrong?
Or does anyone know a better way to run something as root?
Note: I want to use this in the PHP exec() function.

Thanks
Umek
 
Old 03-17-2004, 04:59 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Sorry ... :)


Cheers,
Tink
 
Old 03-18-2004, 10:41 AM   #3
Umek
LQ Newbie
 
Registered: Mar 2004
Posts: 10

Original Poster
Rep: Reputation: 0
Ok I'm confused
 
Old 03-18-2004, 12:43 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Sorry ... I thought I had an answer, but it didn't work.
And one can't delete posts.


Cheers,
Tink
 
Old 03-18-2004, 01:31 PM   #5
Umek
LQ Newbie
 
Registered: Mar 2004
Posts: 10

Original Poster
Rep: Reputation: 0
Ok no problem. I still don't have a solution tho
 
Old 03-18-2004, 02:01 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
What about turning password of for that
specific command? :}


Cheers,
Tink
 
Old 03-19-2004, 09:17 AM   #7
Umek
LQ Newbie
 
Registered: Mar 2004
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by Tinkster
What about turning password of for that
specific command? :}


Cheers,
Tink
lol that would result in major security flaws since the server runs as shell account server
 
Old 03-21-2004, 01:11 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
People would still need to have access to
your user account to run the command ...

If sudoers looked e.g. like this
<user> <host> = NOPASSWD: <specific command>

You'd have to be logged in as yourself,
or an other user would have to know your
passwprd to su and run it ...


Cheers,
Tink
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sudo password...? yubimusubi Linux - General 15 09-04-2009 12:08 AM
Sudo Su denies password accepted bu just Su arew264 Linux - Software 2 09-29-2005 07:35 PM
make sudo ask for a password andy753421 Linux - Security 1 01-13-2005 07:32 PM
root password doesn't work when I use sudo ... bucovaina78 Linux - Security 5 11-10-2004 02:50 PM
Sudo authorizes me with incorrect password? jhermans Linux - Security 4 08-29-2004 09:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration