mirror of
https://github.com/atmoz/sftp.git
synced 2024-12-22 13:14:42 -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
10
entrypoint
10
entrypoint
|
@ -55,6 +55,7 @@ function createUser() {
|
|||
fi
|
||||
|
||||
useradd $useraddOptions $user
|
||||
mkdir -p /home/$user
|
||||
chown root:root /home/$user
|
||||
chmod 755 /home/$user
|
||||
|
||||
|
@ -65,9 +66,12 @@ function createUser() {
|
|||
|
||||
echo "$user:$pass" | chpasswd $chpasswdOptions
|
||||
|
||||
cat /home/$user/.ssh/keys/* >> /home/$user/.ssh/authorized_keys
|
||||
chown $user /home/$user/.ssh/authorized_keys
|
||||
chmod 600 /home/$user/.ssh/authorized_keys
|
||||
# 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
|
||||
chown $user /home/$user/.ssh/authorized_keys
|
||||
chmod 600 /home/$user/.ssh/authorized_keys
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ $1 =~ ^--help$|^-h$ ]]; then
|
||||
|
|
Loading…
Reference in a new issue