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

Re: bash login for root



On Wed, Sep 13, 2000 at 09:23:30PM -0700, Krzys Majewski wrote:
> Bob Nielsen <nielsen@oz.net> writes:
> 
> > I use sudo, logged in as a regular user.  It's generally considered a
> > security risk to be logged in as root, and a bit less of a risk to use
> > sudo or fakeroot. 
> 
> Aha. I only started using sudo seriously about an hour ago. 
> 
> > Funny, but 'sudo echo $PATH' gives the $PATH of the user, but 'sudo
> > whoami' says root.  
> 
> Hm, that's not *that* surprising, is it? The first one says, 
> "run the  'echo' command  as if you  were root" (presumably  the $PATH
> part gets expanded before the call to sudo). The second one says, "run
> the 'whoami' command is if you were root", and works as expected. 
> 

I see.

> > sudo does access the binaries in /usr/sbin, which
> > are not in the user's $PATH.
> > 
> 
> Really? My PATH is something like this:
> 
> /home/krzys/shell:.:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
> 
> (Come  to think of  it this  makes no  sense, neither  /etc/profile nor
> ~/.bashrc set the  path quite like this, but anyway.) Is  it a bad idea
> to have  /usr/sbin/ in one's path?  For things like  /sbin/halt I give
> the following permissions:
> -rwsr-xr--    1 root     admin        7796 Jun 25 05:23 halt*

That will work.  I don't think the sbin directories are in user paths
by default.  Of course, the considerations here are probably based on
what a multi-user system would use.  

-- 
Bob Nielsen, N7XY                          nielsen@oz.net
Bainbridge Island, WA                      http://www.oz.net/~nielsen
 



Reply to: