shell script switching user question
Hello. I'm in need of a shell script that can switch users. However, I can't seem to get it to work. It will execute the su command but it keeps prompting me for a password. How do I pass this in? I'm writing this in php, so here's what i've tried so far:
exec("su userid -c pass"); nope. exec("su -c user id pass"); nope. exec("su -c user id 'pass'"); nope. If someone could let me know what i'm doing wrong or point to a site that show me it would be greatly appreciated! Thanks in advance! |
Welcome to LQ.
I don't think you can pass a password as an argument. A few possible solutions: Check if you can run your command setuid. Write an expect script to run su. |
All times are GMT -5. The time now is 11:29 PM. |