[sudo-users] Feature request - chdir option

Ladner, Eric (Eric.Ladner) Eric.Ladner at chevron.com
Tue Oct 18 14:58:37 EDT 2005

Ah.. I understand the issue and feel your pain.  I've ran into that one
with poorly written vendor scripts (where do all the good script writers

In the past, I've solved this with something like this:

file:  upgrade.sh-----
 cd /foo/bar/dir

sudo ./upgrade.sh

But, I realize that that also doesn't always work.  I can see where the
-C option (a la tar) would be helpful.


-----Original Message-----
From: sudo-users-bounces at courtesan.com
[mailto:sudo-users-bounces at courtesan.com] On Behalf Of Michael Hill
Sent: Monday, October 17, 2005 4:08 PM
To: sudo-users at sudo.ws
Subject: Re: [sudo-users] Feature request - chdir option

On Mon, Oct 17, 2005 at 07:28:07AM -0700, Ladner, Eric (Eric.Ladner)
>Is this not equivalent (and shorter)
>	$ sudo ls -l /usr/local/protected

For my (decidedly trivial) example, yes.  My fault for choosing a poor

Here's a closer approximation to the real-life scenario I was asking

For an upgrade of a third-party vendor's humongous software package, the
installer has to follow pages of procedures of the form:

	$ su -
	<enter root password>
	# cd /foo/bar/dir
	# ./custom_vendor-supplied_program
	# ./yada_yada_yada
	# ./and_so_forth

The installer does not have permission to 'cd' into /foo/bar/dir and for
various reasons it may not be desirable to open up permissions for the
duration of the upgrade.  Furthermore, the (poorly written)
custom_vendor-supplied_program must be run with /foo/bar/dir as its cwd.
Finally, the installer doesn't necessarily have the skills to come up
with workarounds involving alternate sudo commands, and instead insists
he/she must have 'sudo ksh' to accomplish the upgrade.  (If you haven't
ever run into any of these factors in the Real World (tm), I envy you.
:^)  )

In a situation like this, a simple "sudo -C /foo/bar/dir
./custom_vendor-supplied_program" would be exactly what we need.

I hope that helps.


Michael Hill   <><  Isaiah 9:6 |
michael AT mhill DOT net       |
Aerospace/Software Engineer    | 
http://www.qadas.com/~msh/     |
---In a marketplace (like the one of ideas), not everything has equal
value!--- Did you ever notice that everybody in favor of abortion has
already been born?!

More information about the sudo-users mailing list