This does not do what you want, what happens if mkpasswd() yields illegal characters for a second time in a row?:
my $password = mkpasswd(); if ( $password =~ m/\"|\'/ ) { $password = mkpasswd(); }
consider this instead:
my $password; do { # theoretically it can get stuck in an infinite loop here... $password = mkpasswd(); } while( $password =~ m/\"|\'/ );
As for deleting user dirs, you really should check rmtree's return code, see File::Path . Also check each system()'s return code and handle failures accordingly. You don't do this.
For a discussion about using system() and alternatives see Calling External Commands More Safely
In reply to Re: Script for SFTP users not deleting accounts automatically
by bliako
in thread Script for SFTP users not deleting accounts automatically
by C18ANT
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |