The following changes the account name just fine except that it also produces an error "user name ... already exists ... at line ...". Just to be clear, the old name changes to the new name in /etc/passwd when the script is run, but it produces an error while doing so. What is the correct way to use Linux::usermod so that no error is produce when changing the account name?
sub rename_account { my ($name,$nname) = (@_); my $account = Linux::usermod->new($name); $account->set('name'=>$nname); }
Perhaps it is a misunderstanding in how to use Linux::usermod. Looking at the manual page, that looks like the correct usage. So perhaps I have read and interpreted it incorrectly.
Edit: The problem seems related to /etc/shadow which seems like it is not updated. So if one changes back and forth between the same two names, the first change goes through but leaves the old name in /etc/shadow so the second attempt fails because the old name is still their. I think...
In reply to Linux::usermod - user name ... already exists by mldvx4
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |