↧
Answer by John Mahowald for How to su non-interactively?
Several ways to become another user. su only works without a password if you are already root. Trying to provide a password to it on the command line is a bad idea, it will expose the credential. Don't...
View ArticleAnswer by tonioc for How to su non-interactively?
You could either use the echo : echo <otherpwd> | su - otheruser -c "my command line" or expect: expect -c 'spawn su - otheruser -c "my command line"; expect "Password :"; send...
View ArticleHow to su non-interactively?
I want to do something like this to non-interactively switch user: su otheruser -p <password> But this obviously doens't work... what will?
View Article