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:
parent
c5d2a490ef
commit
02b5d4d09e
1 changed files with 7 additions and 3 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue