View previous topic :: View next topic |
Author |
Message |
HailandKill n00b
Joined: 25 Nov 2006 Posts: 8
|
Posted: Sun Oct 07, 2007 11:56 am Post subject: Sudo cd |
|
|
None of my sudo users, including root itself, can # sudo cd [path]
so.. use cd.
I'm not a brilliant linux administrator, so I'm not too sure what the problem is or how to rectify it! |
|
Back to top |
|
|
tobr Guru
Joined: 29 May 2006 Posts: 330
|
Posted: Sun Oct 07, 2007 12:03 pm Post subject: |
|
|
That's because cd is not an executable (try which cd) but a shell built-in. It also only sets the current dir for the running shell so it makes no sense to cd with sudo as that change would be lost after sudo executation. What do you want to do? _________________ Please add [SOLVED] to your message title if your problem is solved.
Death to all blobs! |
|
Back to top |
|
|
HailandKill n00b
Joined: 25 Nov 2006 Posts: 8
|
Posted: Sun Oct 07, 2007 12:31 pm Post subject: |
|
|
I'm setting up a system by which users other than root can deploy ruby on rails apps to my web server using capistrano. Getting sudo cd to work was perhaps me going off on a tangent.
On the local machine I run # cap cold:deploy which does everything well untill
Code: |
Sorry, user yumc is not allowed to execute '/bin/sh -c cd /var/www/localhost/htdocs/yumc/current && nohup script/spin' as yumc on goldx.
command finished
command "sudo -u yumc sh -c 'cd /var/www/localhost/htdocs/yumc/current && nohup script/spin'" failed on www.yumc.co.uk
|
At the moment though, just tot try and get this working the sudoers file reads:
yumc ALL=ALL
So I'm a bit confused.
Here is my sudoers file http://rafb.net/p/J12JBI43.html |
|
Back to top |
|
|
tobr Guru
Joined: 29 May 2006 Posts: 330
|
Posted: Sun Oct 07, 2007 12:46 pm Post subject: |
|
|
The command sudo -u yumc sh -c 'cd /var/www/localhost/htdocs/yumc/current && nohup script/spin' looks suspicious: What you probably wanted to do was execute sh -c 'cd /var/www/localhost/htdocs/yumc/current && nohup script/spin' as yumc. But -c is an option to both sh and sudo so it is possible that sudo gets confused. What I would do (if this is possible) is to cd before sudo. Or try to change the line to sudo -u yumc "sh -c 'cd /var/www/localhost/htdocs/yumc/current && nohup script/spin'".
Another possibility: Have you tried to replace yumc ALL=ALL with yumc ALL=NOPASSWD:ALL? It could be that if sudo is called from a script that you never see the password prompt and it fails because it demanded password authentication.
Note: if you give yumc the right to do everything with sudo, it doesn't make much sense to do it as yumc instead of root in the first place (at least security-wise). Why don't you try to change the permissions of the directories you want the users to put their Rails stuff into? (I don't know anything about Rails and haven't the slightest idea what "capistrano" is, so I can't help you with the specifics) _________________ Please add [SOLVED] to your message title if your problem is solved.
Death to all blobs! |
|
Back to top |
|
|
HailandKill n00b
Joined: 25 Nov 2006 Posts: 8
|
Posted: Sun Oct 07, 2007 12:58 pm Post subject: |
|
|
The only reason I've got ALL at the moment is just to try and get the damn thing working in the first place.
I will try your other suggestions though, thank you. |
|
Back to top |
|
|
|