D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] sudo su

 

On Wed, Dec 17, 2008 at 05:04:02PM +0000, Simon Williams wrote:
> Rob Beard wrote:
> > Benjamin M. A'Lee wrote:
> >> On Mon, Dec 15, 2008 at 04:59:54PM -0000, Ray Smith wrote:
> >>> You can also use sudo su which will then aske for you account password. Then
> >>> any command you enter after that will be treated as a root command. Very bad
> >>> if you forget you are operating as root.
> >> There's no sense in running 'sudo su' if you want a root shell. 'su' is
> >> a program that prompts for a password and gives you a root shell, like
> >> sudo, but it prompts every time. All 'sudo su' does is run su as root,
> >> bypassing su's password prompt in favour of sudo's.
> >>
> >> sudo -s or sudo -i will give you a root shell (-i will simulate a login
> >> as root, so you'll get root's bashrc etc. rather than your own, and
> >> various environment variables will be set).
> >>
> > 
> > Oooh that's handy, I've generally used sudo su.
> > 
> > I'll have to remember that (sudo -i)
> 
> I always use sudo bash. Maybe that's a bad idea.

Probably not a bad idea, but unnecessary unless you specifically want
bash and you wouldn't get bash otherwise, which seems unlikely (I use
sudo -s, so I get my own shell+dotfiles rather than root's; sudo -i
would give you root's, which on GNU/Linux is probably bash anyway)

-- 
Benjamin M. A'Lee || mail: bma@xxxxxxxxxxxxxx
web: http://subvert.org.uk/~bma/ || gpg: 0xBB6D2FA0
"For every man there is a purpose which he sets up for his life and which he
pursues. Let yours be the doing of all good deeds." -- The Qu'ran, Surah 2

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html