0
0
Fork 0
mirror of https://github.com/atmoz/sftp.git synced 2024-11-17 12:51:33 -05:00

Check if folder is missing

This commit is contained in:
Adrian Dvergsdal 2015-12-21 00:55:32 +01:00
parent c5d2a490ef
commit 02b5d4d09e

View file

@ -55,6 +55,7 @@ function createUser() {
fi fi
useradd $useraddOptions $user useradd $useraddOptions $user
mkdir -p /home/$user
chown root:root /home/$user chown root:root /home/$user
chmod 755 /home/$user chmod 755 /home/$user
@ -65,9 +66,12 @@ function createUser() {
echo "$user:$pass" | chpasswd $chpasswdOptions echo "$user:$pass" | chpasswd $chpasswdOptions
# Add SSH keys to authorized_keys with valid permissions
if [ -d /home/$user/.ssh/keys ]; then
cat /home/$user/.ssh/keys/* >> /home/$user/.ssh/authorized_keys cat /home/$user/.ssh/keys/* >> /home/$user/.ssh/authorized_keys
chown $user /home/$user/.ssh/authorized_keys chown $user /home/$user/.ssh/authorized_keys
chmod 600 /home/$user/.ssh/authorized_keys chmod 600 /home/$user/.ssh/authorized_keys
fi
} }
if [[ $1 =~ ^--help$|^-h$ ]]; then if [[ $1 =~ ^--help$|^-h$ ]]; then