3 ms·
No need for 'su' to get a root shell. You can use 'sudo -s' for that, and you still set a root-specific PS1 in the bashrc file.
by silvestrov 16y ago
No need for 'su' to get a root shell. You can use 'sudo -s' for that, and you still set a root-specific PS1 in the bashrc file.
- thwarted 16y agoThis doesn't always run the same rc scripts (depending on the shell and local convention). I'm used to typing sudo su - (with optional username) to get the environment as close as possible to what it would be if I logged in as the target user.
- deleted 16y ago[deleted]
- silvestrov 16y agoalias ssu='sudo /bin/bash -login'
- pilif 16y agosudo -s launches a shell in non interactive mode (which goes through .bashrc or .zshenv and .zshrc depending on your shell) whereas sudo -i emulates a usrer login which puts the shell in interactive mode (.profile, .zshenv) Also -i does more stuff to simulate a login like setting $HOME and cd'ing there. Usually you might want to use sudo -i or 'su -' which both simulate a login. But sudo su - really isn't needed any more since -i has been added
- thwarted 16y agoOld habits die hard.