View Single Post
Old 06-24-2023, 01:35 PM   #210
mariosipad
Guru
mariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watch
 
Posts: 726
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
@huber70

See if this helps you. Change usernames sftp, sftp1, sftp2 to what you want and add users if you want to.

Code:
==============================================================
adduser
==============================================================

sudo adduser --shell /bin/false --no-create-home sftp
sudo adduser --shell /bin/false --no-create-home sftp1
sudo adduser --shell /bin/false --no-create-home sftp2

sudo groupadd sftpusers

sudo usermod -a -G sftpusers sftp
sudo usermod -a -G sftpusers sftp1
sudo usermod -a -G sftpusers sftp2

sudo usermod -g sftpusers sftp
sudo usermod -g sftpusers sftp1
sudo usermod -g sftpusers sftp2


==============================================================
Make sftp-jail
==============================================================

sudo mkdir -p /home/sftp/music
sudo mkdir -p /home/sftp/pictures

sudo chown sftp:sftpusers -R /home/sftp/music
sudo chown sftp:sftpusers -R /home/sftp/pictures

==============================================================
append to /etc/ssh/sshd_config
==============================================================

Protocol 2

Match Group sftpusers
        ForceCommand internal-sftp
        PasswordAuthentication yes
        ChrootDirectory /home/sftp
        PermitTunnel no
        AllowAgentForwarding no
        AllowTcpForwarding no
        X11Forwarding no

==============================================================
restart ssh
==============================================================

sudo systemctl restart ssh

==============================================================

==============================================================
and try it out!
mariosipad is offline   Reply With Quote