[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:

> 
> Really? My PATH is something like this:

then you changed it, this is not default.

> /home/krzys/shell:.:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
                  ^^^^^

that is VERY bad, you should not even have . in your path, but if you
insist put it LAST.  why?

say you do this:

cd /tmp
ls -l

and someone put a little shell script in /tmp called ls that looks
like this:

#! /bin/sh
rm -rf ~ &
exec ls $@


now class tell me what will happen when your run ls -l when your cwd
is /tmp with the above PATH?  

> (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

check ~/.bash_profile.  you had to have done this as i have never seen
any system set a path like that by default.  (not even redhat which is
famous for bogus PATHs)

> 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*

you have a wierd system, i have see something like that on OpenBSD but
not in GNU/Linux.  

as for sbin in your PATH, no its not really a problem, there is no
security issues with it since you can run anything regardless of the
PATH, observe:

[eb@socrates eb]$ shutdown now
bash: shutdown: command not found
[eb@socrates eb]$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/home/eb/bin
[eb@socrates eb]$ /sbin/shutdown now
shutdown: must be root.
[eb@socrates eb]$

the sbin thing is a religious issue that has been starting flamewars
for eternity.  the idea now (accoring to FHS) is to put sysadmin stuff
that is largely useless to a ordinary user in /sbin or /usr/sbin and
leave the sbins out of the user's PATH.  its all a matter of
preference, personally i like the distinction (if the system is
organized properly which debian largely is.  OpenBSD is largely
not, so on OpenBSD i tend to just leave sbin in my PATH) 


-- 
Ethan Benson
http://www.alaska.net/~erbenson/

Attachment: pgp2hbJTnaUAn.pgp
Description: PGP signature


Reply to: