sudo -s
apt update
apt upgrade
apt install -y ssh

addgroup sftp
adduser azaionsftp
usermod -G sftp azaionsftp
usermod -a -G sftp zxsanny

chown root:root /home/azaionsftp

cd /home/azaionsftp
mkdir datasets
chown -R azaionsftp:azaionsftp datasets
mount -o bind /azaion/datasets datasets

chown -R zxsanny:sftp /azaion/data
mkdir data
chown -R azaionsftp:azaionsftp data
mount -o bind /azaion/data data

chown -R zxsanny:sftp /azaion/data-processed
mkdir data-processed
chown -R azaionsftp:azaionsftp data-processed
mount -o bind /azaion/data-processed data-processed

chown -R zxsanny:sftp /azaion-media/nogps-flights
mkdir nogps-flights
chown -R azaionsftp:azaionsftp nogps-flights
mount -o bind /azaion-media/nogps-flights nogps-flights


chmod -R 755 /home/azaionsftp/

cat <<EOT >> /etc/ssh/sshd_config
Match Group sftp
    ChrootDirectory %h
    PasswordAuthentication yes
    AllowTcpForwarding no
    X11Forwarding no
    ForceCommand internal-sftp
EOT
service ssh restart

