S
sitnam81
Base question
--------
Is there a way to perform 2 commands via system()? I would like to
execute a "sudo - root" and then "useradd" (or perhaps a script that
does the "useradd")?
Details
-------
I am relatively new to perl, and I am writing a cgi-script that will be
a front end for adding a user -- it takes input from a form (username,
UID, group, password) and performs in a loop across other servers:
system("ssh", "-l", $user, "-q", $SERVER{$loop}, $addcommand, "| 2>&1
I was able to get this working, but the $addcommand is a simple "cat of
a file into a temp file" to confirm it works. I need to perform a
"useradd" with all the options as the root user. The script is run as
a different user, so I will need to su to root (add su - root in
sudoers), and then perform the "useradd" command passing all the
arguements.
--------
Is there a way to perform 2 commands via system()? I would like to
execute a "sudo - root" and then "useradd" (or perhaps a script that
does the "useradd")?
Details
-------
I am relatively new to perl, and I am writing a cgi-script that will be
a front end for adding a user -- it takes input from a form (username,
UID, group, password) and performs in a loop across other servers:
system("ssh", "-l", $user, "-q", $SERVER{$loop}, $addcommand, "| 2>&1
/dev/null");
I was able to get this working, but the $addcommand is a simple "cat of
a file into a temp file" to confirm it works. I need to perform a
"useradd" with all the options as the root user. The script is run as
a different user, so I will need to su to root (add su - root in
sudoers), and then perform the "useradd" command passing all the
arguements.