How to run command as another user in Linux
Sometimes its necessary to execute commands as another user than the logged in. We can use runuser to achieve such requirements.
#runuser -l username -c 'command'
Here we need to replace username and command appropriately.
Alternatively we can use su command also.
#su - username -c "command"
Here we need to replace username and command appropriately.
That's all…