It seems that sudo su newuser should also work if sudo would only be looking if the currently logged in user has sudo rights to sudo to the new user. What is sudo su doing and why is it important for non-root users to use sudo su - newuser with the hyphen?

1 Answer
1

In su - username, the hyphen means that the user's environment is replicated, i.e. the default shell and working directory are read from /etc/passwd, and any login config files for the user (e.g. ~/.profile) are sourced. In short, you pretty much get the same environment as if you logged in normally. (Though the new user may not own the terminal, causing programs like screen to fail.)

Not using the hyphen, will cause you to more or less keep the environment of the user that invoked su, including leaving you in the same working directory, where you may not have permissions.

su won't ask for a password if the root user invoked it, so if you first have used sudo (or su) to become root, you won't need a password to become any other user.