Contents
How do I allow someone to su to another user?
Create a group using addgroup that other users will be able to su to without a password. Then add that group to each user that you want to be able to su to that user without a password: usermod -a -G (or usermod -a -G oracle tom ).
How do I switch users from one user to another in Linux?
To change to a different user and create a session as if the other user had logged in from a command prompt, type “su -” followed by a space and the target user’s username. Type the target user’s password when prompted.
How do I create a root password?
The procedure to change the root user password on Ubuntu Linux:
- Type the following command to become root user and issue passwd: sudo -i. passwd.
- OR set a password for root user in a single go: sudo passwd root.
- Test it your root password by typing the following command: su –
How to switch ( Su ) to another user account without password?
To allow users in a specific group to switch to another user account without a password, we can modify the default PAM settings for the su command in the /etc/pam.d/su file. Add the following configurations after “auth sufficient pam_rootok.so ” as shown in the following screenshot.
Is there a single line command to do ` Su’?
If you write a password in a command like su -p , it would be stored in plain text in your bash history. This is certainly a huge security issue. If you need to run commands with su (or sudo) in an automated way, write a shellscript containig the commands without su or sudo and run su script.sh.
How to switch to another user account with sudo?
In this case, the user (for example aaronk) who will switch to another user account (for example postgres) should be in the sudoers file or in the sudo group to be able to invoke the sudo command. Then add the following configuration below the line “%sudo ALL= (ALL:ALL) ALL” as shown in the following screenshot. Save and close the file.
How to pass password to su / sudo / SSH without Sudo?
Take a look at expect linux utility. It allows you to send output to stdio based on simple pattern matching on stdin. (sleep 5; echo PASSWORD; sleep 5; echo ls; sleep 1) | socat – EXEC:’ssh -l user server’,pty,setsid,ctty EXEC’utes an ssh session to server.