in reply to Re^4: Linux::usermod - user name ... already exists
in thread Linux::usermod - user name ... already exists
Since you're setting a restricted PATH, are you running this under taint mode? If so, are $newname and $oldname user input? If yes, I would strongly recommend against putting them in a shell command like this (even though I assume you had to untaint them first). I'd suggest at the very least using system in the list form with more than one argument, e.g.:
system('usermod','--login',$newname,'--home',$newname,$oldname) ==0 or die "usermod failed, \$?=$?"; system('groupmod','--new-name',$newname,$oldname) ==0 or die "groupmod failed, \$?=$?";
I wrote more on the topic of avoiding the shell here.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Linux::usermod - user name ... already exists
by mldvx4 (Hermit) on Mar 22, 2019 at 11:59 UTC | |
by haukex (Archbishop) on Mar 25, 2019 at 09:55 UTC |