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

Re: sudo and shell builtins



On Sat, Aug 03, 2002 at 09:40:31AM -0400, Alan Shutko wrote:
> Osamu Aoki <debian@aokiconsulting.com> writes:
> 
> > So right thing is to make small shell program: /usr/local/bin/listit
> > from root with root:root 700
> >
> > ---
> > #!/bin/sh
> > cd /root/hidden && ls
> 
> Why would you do that?  You can always do a sudo ls /root/hidden.  If
> you want to do multiple commands somewhere without typing the path
> over and over again, 
> 
> D=/root/hidden
> sudo ls $D
> sudo tail $D/file
> etc....

Yeah, that of course works.

Method you described give acccess to the any directory while what I
suggested only allows "ls /root/hidden".

I was just following up original question in generic way (not just "ls")

Original question was:
  "In short, is there a way to execute a shell builtin as root using
  something like sudo, or must I always open a root shell to use 'cd' or
  similar?"

BTW, /usr/local/bin/listit could have been
---
#!/bin/ls /root/hidden
---
this eliminate shell execution and faster.

-- 
~\^o^/~~~ ~\^.^/~~~ ~\^*^/~~~ ~\^_^/~~~ ~\^+^/~~~ ~\^:^/~~~ ~\^v^/~~~ +++++
 Osamu Aoki @ Cupertino CA USA
 See "User's Guide":     http://www.debian.org/doc/manuals/users-guide/
 See "Debian reference": http://www.debian.org/doc/manuals/debian-reference/
 "Debian reference" Project at: http://qref.sf.net

 I welcome your constructive criticisms and corrections.



Reply to: