[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: sudo and shell builtins



[replying to the list]

scripsit Eric Hanchrow:
> >>>>> "Thanasis" == Thanasis Kinias <tkinias@optimalco.com> writes:
> 
>     Thanasis> In short, is there a way to execute a shell builtin as
>     Thanasis> root using something like sudo, or must I always open a
>     Thanasis> root shell to use 'cd' or similar?
> 
> You could always `cd' *before* running sudo, assuming that, as a
> mortal, you have read and execute access to the directory in question.

In the particular case I was dealing with, only root had access to the
directory.

> For other builtins, and for shell functions (I use a lot of the
> latter), you might find this useful:
> 
>         $ sudo bash -c your-function
 
Unfortunately, this doesn't work for 'cd' because when that bash exits
you're back where you started (PWD-wise). 

-- 
Thanasis Kinias
Web Developer, Information Technology
Graduate Student, Department of History
Arizona State University
Tempe, Arizona, U.S.A.

Ash nazg durbatul�k, ash nazg gimbatul,
Ash nazg thrakatul�k agh burzum-ishi krimpatul



Reply to: