rguyer has asked for the wisdom of the Perl Monks concerning the following question:
Here is the code that doesn't work:system ("$useradd -d /home/sites/site$site_count/users/$username -g si +te$site_count -G site-adm$site_count -p $password -s /bin/false -u $u +id $username");
It also works fine if I take out the \" and just make sure that $fullname is only one word. Otherwise, that causes problems too. The non-working line works fine on the command line when run by root. Why are the quotes causing an error? The error I get is:system ("$useradd -c \"$fullname\" -d /home/sites/site$site_count/user +s/$username -g site$site_count -G site-adm$site_count -p $password -s + /bin/false -u $uid $username");
and more specifically with strace on(last few lines):useradd: unable to lock password file
Do the quotes cause part of the useradd command to be run as the web user without setuid? How do I get around this? Any suggestions would be greatly appreciated.open("/var/nis/NIS_COLD_START", O_RDONLY) = -1 ENOENT (No such file or + directory) open("/etc/.pwd.lock", O_WRONLY|O_CREAT, 0600) = -1 EACCES (Permission + denied) write(2, "useradd: unable to lock password"..., 38useradd: unable to l +ock password file
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using doublequotes in a system call
by emilford (Friar) on May 18, 2002 at 18:22 UTC | |
|
Re: Using doublequotes in a system call
by particle (Vicar) on May 18, 2002 at 18:40 UTC | |
by rguyer (Novice) on May 18, 2002 at 19:01 UTC | |
by particle (Vicar) on May 19, 2002 at 02:08 UTC | |
by kjherron (Pilgrim) on May 19, 2002 at 05:39 UTC | |
by particle (Vicar) on May 19, 2002 at 12:37 UTC | |
|
Re: Using doublequotes in a system call
by mattriff (Chaplain) on May 19, 2002 at 00:20 UTC |