sudo versus #

email.listen at googlemail.com email.listen at googlemail.com
Thu Feb 11 09:31:57 UTC 2010


Am Do, 11. Februar 2010 09:55:27 schrieb Avi Greenbury:
[...]
> 
> So in order to work as root, you now have to
> 
> $ su super
> $ sudo <somecommand>
> $ sudo <nextcommand>
> 
> rather than just giving root a password and doing
> 
> $ su
> # somecommand
> # nextcommand
> 
> This seems needlessly over-complicated to me.

So 'sudo -i' may be what you are looking fore?

— bash —
  $ sudo -i
  # somecommand
  # nextcommand
— bash —

If you add an aliass to your '.bash_aliases' file:

—8<— $HOME/.bash_aliases —8<—
  alias sudoi='sudo -i '
—8<— $HOME/.bash_aliases —8<—

 (!Don't add an alias su='sudo -i'! 
 There are a lot of scripts using 'sudo su -c' and an alias su='sudo -i' will
  cause a lot of trouble:
    sudo su -c ls
  works, but
    sudo sudo -i -c ls
  not
 )

And enable '.bash_aliases' in your '.bashrc':

—8<— $HOME/.bashrc —8<—
  # Alias definitions.
  # You may want to put all your additions into a separate file like
  # ~/.bash_aliases, instead of adding them here directly.
  # See /usr/share/doc/bash-doc/examples in the bash-doc package.
  if [ -f ~/.bash_aliases ]; then
      . ~/.bash_aliases
  fi
—8<— $HOME/.bashrc —8<—

Now it only needs 3 letters more than the classic su to become root

regards,
thomas




More information about the ubuntu-users mailing list