mirror of
https://github.com/atmoz/sftp.git
synced 2024-11-17 12:51:33 -05:00
Disable password login if password is zero
This commit is contained in:
parent
bfe3c13470
commit
125d105403
1 changed files with 4 additions and 5 deletions
|
@ -61,12 +61,11 @@ function createUser() {
|
|||
chown root:root /home/$user
|
||||
chmod 755 /home/$user
|
||||
|
||||
if [ -z "$pass" ]; then
|
||||
pass="$(tr -dc A-Za-z0-9 </dev/urandom | head -c256)"
|
||||
chpasswdOptions=""
|
||||
fi
|
||||
|
||||
if [ -n "$pass" ]; then
|
||||
echo "$user:$pass" | chpasswd $chpasswdOptions
|
||||
else
|
||||
usermod -p "*" $user # disabled password
|
||||
fi
|
||||
|
||||
# Add SSH keys to authorized_keys with valid permissions
|
||||
if [ -d /home/$user/.ssh/keys ]; then
|
||||
|
|
Loading…
Reference in a new issue