Could someone kind enough explain to me what this command means?
sudo su -s /bin/bash - foo
I was told that if I want to switch to a different account in this case "foo" without knowing its password use this command.
sudo
is a command that executes whatever command follows as another user (if no username is given like in this case, that user is root
) - to be able to do this, the account from which sudo
is being executed needs to have the necessary permissions setup (see /etc/sudoers
)
su
starts a new shell under a different user id
-s /bin/bash
specifies the shell to be started, i.e. /bin/bash
-
makes that shell a login shell
foo
is the user with whose user id and group id will the new shell be started