I have 3 users in my server:
- root
- user1
- user2
When I try to change my current user from user1 to user2 by using the command sudo su user1, my operating system sometimes changes instead from user1 to root (this is verified by using the whoami command).
The opposite happens when I try to change my current user from user1 to root by using the command sudo su root, the OS sometimes changes from user1 to user2.
Some extra errors (or symptoms) detected are:
- When already logged as user2 I can't change to root user by any method (I end up restarting the server connection until it works).
- Sometimes when I am logged as either root or user2 and time passes I find that my current user has changed automatically from root to user2 or vice versa.
- The user name does not display correctly in command line when logged as root or username2 (it sometimes displays
[user1@IP ~] #while thewhoamicommand displaysroot, for example).
sudo su useris being used to not prompt for password (I am aware of the security implications of doing this). Anyways, if I usesu userand introduce the password manually the exact same problem still rises. I have read the manuals you mentioned and used both options, unfortunately with no results. The sequence of commands used is only:sudo su userorsu user. Any other suggestions? Thanks.su -l userandsu -l rootstill reproduce the issue. I have feeling that it has to do with some kind of "user aliases" or "environment variables" as you mentioned, unfortunately I haven't found related info to test it.sudo su: if a user can usesudowithout a password, thensudo -iu usernameis the command to use. There really is no purpose invokingsudo su.id user1andid user2?USER,LOGNAMEandMAILenvironment variables are being overwritten from one another occasionally. Already tried to search for the process that generates them, with no luck.