[Novalug] "Root" / sudo in Ubuntu (was launch perl script from ubuntu desktop)
donjr
djr1952 at hotpop.com
Tue Jun 26 13:37:23 EDT 2007
On Tue, 2007-06-26 at 13:00 -0400, rogerb at bronord.com wrote:
> A neat trick learnt from Peter (what's-his-name):
> sudo bash
Why not instead:
sudo -i
See 'man sudo'
The following is from the man page:
-i The -i (simulate initial login) option runs the shell specified in
the passwd(5) entry of the user that the command is being run as.
The command name argument given to the shell begins with a - to
tell the shell to run as a login shell. sudo attempts to change to
that user’s home directory before running the shell. It also
initializes the environment, leaving TERM unchanged, setting HOME,
SHELL, USER, LOGNAME, and PATH, and unsetting all other environment
variables. Note that because the shell to use is determined before
the sudoers file is parsed, a runas_default setting in sudoers will
specify the user to run the shell as but will not affect which
shell is actually run.
If the user(root) default shell is 'bash' then 'sudo -' is close to:
sudo su -
and you don't wind up with files owned by 'root' in your HOME directory
unless you CREATE them on propose.
> after entering a password, one is running a bash shell in-a-shell. Here, I do
> things like
> >nautilus
OH you want to run X windows applications with user 'root' level access.
Boy do you like to take chances with your system. <GRIN>
'nautilus' would be running with user ROOT level system access and
your regular user environment setting. Not a safe combo if a CRASH
happens.
{Something like running Micros??t XP with ADMIN access enabled by
default.}
Of course another way to open a 'nautilus' window with 'root' level
access is:
$ gksu nautilus
{-: NOT that that way is any safer, but... :-}
> search directories and open files to edit them, from within nautilus but under
> the privileged bash shell - a nice way to look thru directories and edit
> config files, etc. One can also, of course,
> >gedit
> to open the simple editor.
To open gedit with root level access on a file try:
$ gksu gedit FileName
Now that I do from time to time, but I use a different editor, ie a
simple text mode, one as I prefer 'mcedit'.
> Of course, don't forget to close the programs and ctrl-d out of the privileged
> shell.
Why 'ctrl-d' instead of using a proper 'exit' command at the prompt?
--
--
Don E. Groves, Jr.
$ /usr/games/fortune :
The secret source of humor is not joy but sorrow; there is no humor in
Heaven. -- Mark Twain
More information about the Novalug
mailing list