diff --git a/docs/user-guide/switching_users.md b/docs/user-guide/switching_users.md new file mode 100644 index 00000000..4625d7f5 --- /dev/null +++ b/docs/user-guide/switching_users.md @@ -0,0 +1,25 @@ +# Switching Users + +In Linux there are several ways to switch between users. Some common methods are: + +```bash +# Using su command +su username +su - username +# Using sudo to switch user +sudo su username +sudo su - username +``` + +- `su username`: Switches to the specified user without loading their environment. +- `su - username`: Switches to the specified user and loads their environment. +- `sudo su username`: Switches to the specified user with superuser privileges without loading their environment. +- `sudo su - username`: Switches to the specified user with superuser privileges and loads their environment. + +Depending on which command you are using the behavior and environment settings may differ. Also some commands will not acquire a kerberos ticket for the new user and therefore certain network resources may not be accessible until a new ticket is acquired. + +To overcome these issues there is an additional command `become` which takes care of all these aspects. So if you want to switch user, always use: + +```bash +become username +```