login to user using script
I am trying to write a script. The purpose of the script is to login to perticular user and execute some commands.
su tom -c "df -h"
When I am running this script as root, it is not asking me any password.
but I want to run this script as normal user. When I am running this script as normal user it is asking me password for user tom.
I want to provide password in script only.
How can I do it? Can I use --stdin?