[clue] sudo and sudoers: force changing working directory

Sean LeBlanc seanleblanc at comcast.net
Mon Oct 17 14:21:03 MDT 2011


So, I want to be able to have a certain user sudo to a specific user and 
run a specific command.

Preferably, I'd like to NOT have to remember to change working directory 
to the target user's home dir prior to running that specific command.

I have always_set_home in sudoers as the default, but setting home is 
not enough - working directory has to be changed.

I thought I'd try out giving sudo the "-i" flag, but that then seems to 
result in having to type in password, even though that is not desired 
for this scenario.

Any ideas on how to achieve this?

right now, the command looks like this:

sudo -u targetuser "cd /home/targetuser; thecommand"





More information about the clue mailing list