Skip to main content

That's because su asks for password of the user you're changing into (which by default is root password) while sudo asks for your own user accountaccount's password and checks if you are allowed to run the command.

When you run sudo su you are asking sudo to run the command su as root, which gives you the root shell. If you are using only su you will have to know the roottarget user's password to have access.

Using sudo without parameters implies that you want to use root. If you want to execute the command as another user, try sudo -u <username> <command>

That's because su asks for the root password while sudo asks for your user account password and checks if you are allowed to run the command.

When you run sudo su you are asking sudo to run the command su as root, which gives you the root shell. If you are using only su you will have to know the root password to have access.

Using sudo without parameters implies that you want to use root. If you want to execute the command as another user, try sudo -u <username> <command>

That's because su asks for password of the user you're changing into (which by default is root) while sudo asks for your own user account's password and checks if you are allowed to run the command.

When you run sudo su you are asking sudo to run the command su as root, which gives you the root shell. If you are using only su you will have to know the target user's password to have access.

Using sudo without parameters implies that you want to use root. If you want to execute the command as another user, try sudo -u <username> <command>

Source Link
Renan
  • 601
  • 6
  • 7

That's because su asks for the root password while sudo asks for your user account password and checks if you are allowed to run the command.

When you run sudo su you are asking sudo to run the command su as root, which gives you the root shell. If you are using only su you will have to know the root password to have access.

Using sudo without parameters implies that you want to use root. If you want to execute the command as another user, try sudo -u <username> <command>