From ccfe46ec8c8c57d08d4918de8d6b9f3a5e1a3af3 Mon Sep 17 00:00:00 2001 From: ebner Date: Tue, 20 Jan 2026 11:21:42 +0100 Subject: [PATCH] add new howto to switch user --- docs/user-guide/switching_users.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 docs/user-guide/switching_users.md 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 +```