Re: bash login for root
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.
> 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*
-chris
Reply to: