Could anybody help with simple question.
I need login/switch user in command line in 1 line; For example:
login -p username ? password
.
What should I write at '?' position? Because I need to login in script which don't know id system asked password...
You could try to use
su - username
in order to switch to the user you want.
You can find more documentation about su
command here
You can provide the password to sudo like this:
echo "p@sw0rd" | sudo -S cal -y 2011
The example above runs 'cal -y 2011' with root permissions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With