Shell confusion
Bill Davidsen
davidsen at tmr.com
Sat Mar 14 13:27:28 UTC 2009
Garry T. Williams wrote:
> On Thursday 12 March 2009 21:25:27 Dave Bolt IT Solutions wrote:
>> When I start a terminal as dave I get a prompt [dave at Test-Host ~]$
>> When I do su amandabackup I get a prompt bash-3.2$
> ^^^^^^^^^^^^^^^
>
> Check the manual page for su(1).
>
> If you had entered `su - amandabackup', that user's login scripts
> would have been run.
>
> In general, using su without its `-' parameter is a bad idea[*]
> especially when switching to the root login.
>
Interesting thought, I generally warn people that "-" or "-l" will do a login,
and they will wind up running in the other user's home directory. Definitely not
what people want many times, such as running "make install" after building a
package, or the like.
For instance
sudo su root -c "make install"
runs the install rules in the current directory, probably just what you wanted.
sudo su - -c "make install"
runs the install part of whatever Makefile is in root's home directory. Almost
certainly not what you intended!
> ______________
> [*] Unless, of course, you know why you want to do that.
>
--
Bill Davidsen <davidsen at tmr.com>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot
More information about the fedora-list
mailing list