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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-17-2004, 02:26 PM
|
#1
|
LQ Newbie
Registered: Mar 2004
Posts: 10
Rep:
|
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
|
|
|
03-17-2004, 04:59 PM
|
#2
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
|
|
|
03-18-2004, 10:41 AM
|
#3
|
LQ Newbie
Registered: Mar 2004
Posts: 10
Original Poster
Rep:
|
Ok I'm confused 
|
|
|
03-18-2004, 12:43 PM
|
#4
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
Sorry ... I thought I had an answer, but it didn't work.
And one can't delete posts.
Cheers,
Tink
|
|
|
03-18-2004, 01:31 PM
|
#5
|
LQ Newbie
Registered: Mar 2004
Posts: 10
Original Poster
Rep:
|
Ok no problem. I still don't have a solution tho 
|
|
|
03-18-2004, 02:01 PM
|
#6
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
What about turning password of for that
specific command? :}
Cheers,
Tink
|
|
|
03-19-2004, 09:17 AM
|
#7
|
LQ Newbie
Registered: Mar 2004
Posts: 10
Original Poster
Rep:
|
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 
|
|
|
03-21-2004, 01:11 PM
|
#8
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
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
|
|
|
All times are GMT -5. The time now is 07:55 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|