As we know that, password must be inputted while switching user [Username: test, Password: test]
[user1@hosts ~] $ su test
Password:
[test@hosts ~]$
Now I want to create a shell script (example: login.sh) to switch user without entering password.
My shell script is:
su - test
test # The password of user test
But it still needs password entering.
How can the shell script accept the password? Thanks in advance!!
sudois the tool you need. – Shadok Jan 28 '13 at 11:38expect. – slhck Jan 28 '13 at 11:39