![]() ![]() Make sure the password is a strong secure password. adduser myusernameĮnter a new password for this user. Replace myusername with the user name that you want to create. ssh Create A New UserĬreate a new user account with the command adduser. Replace the IP address with your IP address. If you create a Linux instance from a hosting provider, 0pen up your SSH client and log in as root. This guide will show you how to create a new user with sudo access to the system. The best practice is to create a sudo user account first. When you create a new Linux instance from a hosting provider, most of the time, they will create only one account which is the root user account. Here, we have mentioned two ingenious methods by which you can easily switch (su) to another user account without a password.Sudo is a command enables the user to run commands with the security privileges of another user, by default the root user. So, you can efficiently execute commands with the substitute user. ‘SU’ is an impeccable command that allows the user to become another user temporarily. This time the shell shouldn’t prompt you to enter a password. In the end, try to ‘su’ to the account User_Account as the user Zoop. Zoop ALL=NOPASSWD: /bin/su – User_Account $ sudo visudoĪfterward, you need to include the following configuration below the line “%sudo ALL=(ALL:ALL) ALL”. In this procedure, the user (for example, zoop) who is ready to switch to another user account (for example, User_Account) must be available in the sudoers file or in the sudo group to invoke the Sudo command. Try sudoers file to su to another user account without the need for a password. This time you won’t be prompted for a password. $sudo usermod -aG User_AccountzoopĪt last, ‘su’ to the User_Account as the user zoop. Now, you need to include the user (for example, zoop) who wants to switch to the account User_Account without a password using the usermod command. auth sufficient pam_succeed_if.so use_uid user ingroup User_Account Else, you will observe that the standard authentication steps are run. If the current user is within the group User_Account, then the authentication method would be considered successful and returns sufficient as a result. auth pam_succeed_if.so user = User_Account Else, the default=1 line is skipped, and the rest of the authentication steps are performed. Suppose this is true the service looks over the current user. In the command mentioned earlier, the initial line verifies the target user is User_Account. ![]() #vim /etc/pam.d/suĪfterward, it would be best if you integrated the following configurations after “auth sufficient pam_rootok.so” as shown below auth pam_succeed_if.so user = User_Account auth sufficient pam_succeed_if.so use_uid user ingroup User_Account To do this, you need to run any of the below-mentioned commands. You need to change the default PAM settings to permit users of a specific group to switch to another user account. PAM enables the programs that are subject to authentication to be written independently of the underlying authentication scheme. It is one of the significant authentication programs on modern Linux OS. It is an excellent mechanism that associates multiple low-level authentication schemes to a high-level API. PAM is an abbreviation used for Pluggable Authentication Modules. You can use any of the techniques to accomplish the user switch procedure. Let’s begin! Methods to Switch (SU) into Another User Account in Linux Therefore, in this tutorial, we will shed light on how to switch to another or a specific user account without password help. Plus, the entered password is incorrect they end up with the error – Authentication Failed. However, the rest of the users will prompt to enter the associated password of the corresponding user account. ![]() It is an interesting command that allows executing commands with another user’s privileges ( By default, the root user).ĭue to this, the only root user has the right to switch to another user’s account without entering a password. The ‘su’ is an abbreviate for substitute or switch user. ![]() Alert! The price of convenience is security. Here’s how to switch a user to another user account through the ‘su’ command. Your life can become a little easier with SU (Switch User) command in Linux. Modified: September 15th, 2022 ~ 4 Minutes Reading ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |