run command as alternate user
I need to be able to run an arbitrary command as an arbitrary user without providing any feedback such as a password after the initial invocation. i've looked at su and sudo and runas but they seem like they won't accomplish what I need. I'm looking for something along the lines of
su -l mylogin -p myPassword -e "myProc" any suggestions? Much thanks on this. |
You should be able to do su -l USER -c some_command i.e. su -l bob -c ls /home/bob You will still have to provide a password. You could write a script using expect and feed the password to the command line that way. Fairly easy in perl and I would guess bash can do it also.
One thought, if you were logged in as root, you do not have to provide a password to execute commands as another user. So the su -l bob -c ls /home/bob would work without prompting for a password. You could make a script that ran the commands as each user and fire it off as root and it won't prompt you. HTH! |
All times are GMT -5. The time now is 08:36 AM. |