[sudo-users] Problem with CD command while using sudo

Rogan Dawes discard at dawes.za.net
Fri Jul 29 11:38:32 EDT 2005


Mousumi Kadham wrote:
>  
> Hi ,
> 
> Here is the situation. There are certain commands to be executed, files to
> be edited in a protected directory which has a long path. Without sudo and
> every one using root, administrators simply will do cd to the final
> directory and do many things like editing a few files etc. However with
> sudo, for every command, a long path has to be given and can quickly become
> very irksome to the administrators. Hence the question about 'cd' with sudo.
> 
> Pls. help.
> 
> Regards,
> Mousumi
> 

As mentioned, cd makes changes to the environment of the particular 
shell that calls it. However, sudo creates a new shell/environment when 
changing privileges, so the change that cd makes is immediately lost, 
when the sudo terminates.

You need to rethink how your administrators will work . . .

Sorry

Rogan



More information about the sudo-users mailing list