in reply to Script for SFTP users not deleting accounts automatically
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Script for SFTP users not deleting accounts automatically
by haukex (Archbishop) on Jul 06, 2019 at 15:27 UTC |