LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   shell script switching user question (https://www.linuxquestions.org/questions/linux-newbie-8/shell-script-switching-user-question-118667/)

compupurdy 11-21-2003 06:22 PM

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!

david_ross 11-22-2003 09:03 AM

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.