2

When I access the network server, I use the command sudo su to get admin privileges. Recently I found that sudo bash is the correct command and will allow me privileges those su does not.

What is the difference between sudo su and sudo bash? I thought both were equivalent.

Khaled
  • 36,533
  • 8
  • 72
  • 99
shantanuo
  • 3,579
  • 8
  • 49
  • 66

2 Answers2

3

When you do sudo su you start the default shell of the root user which is likely to be the Bourne shell (sh). You can do sudo -s to get the default shell of the current user.

Dennis Williamson
  • 62,149
  • 16
  • 116
  • 151
1

What privileges do you miss after

sudo su

? It could be that you simply don't have the root's environment set up after this command. If you do

sudo su -

(note the "-"), then the profile of the root user will be read and the environment (among other things PATH variable) will be set as if you have logged in as root. If you run sudo su, you keep your environment and get the effective uid of 0, meaning you have the privileges of root user without having root environment set up. sudo su - changes your current directory to the root's home directory, so I use sudo su if I want to execute a couple of commands in the current dir (e.g. change owner of a file) without having to type in long paths.