Skip to content

Instantly share code, notes, and snippets.

@lyovkin
Last active February 1, 2018 11:27
Show Gist options
  • Save lyovkin/8555162921b0cfd94abf25d28a9839b1 to your computer and use it in GitHub Desktop.
Save lyovkin/8555162921b0cfd94abf25d28a9839b1 to your computer and use it in GitHub Desktop.
Create a user and restrict him to his home dir (sftp)
sudo groupadd sftpusers
sudo adduser importer
sudo chown root:root /home/importer
sudo usermod importer -g sftpusers
sudo mkdir /home/importer/data
sudo chown -R importer:sftpusers /home/importer/data
-------------------------
sftp access configuration
-------------------------
PasswordAuthentication yes
#Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp internal-sftp
Match Group sftpusers
ChrootDirectory %h
ForceCommand internal-sftp
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no
sudo service ssh restart
-----------------------
mount folder (optional)
----------------------
mount --bind /home/importer/data /path/data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment