-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetupSFTP
24 lines (20 loc) · 1.08 KB
/
setupSFTP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#Go to /etc/ssh/sshd_config
#Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp internal-sftp
#We want to match a determined usergroup to apply the below settings
Match Group sftpusers
PasswordAuthentication no #If you need password authentication enable it.
ChrootDirectory %h #Chroot to the home directory of the user
X11Forwarding no #Sftp environment we shouldn't need X11
AllowTcpForwarding no #Disable TcpForwarding we want a straight connection to the SFTP
ForceCommand internal-sftp #We want to use the new one (sftp-server is used just for backward compatibility) And with Chroot we don't need to setup anything else
#### assign SFTP group and prevent ssh login and
sudo usermod -g sftpusers username
sudo usermod -s /bin/nologin username
#### chroot user (so they only see their directory after login)
sudo mkdir /home/username/
sudo mkdir /home/username/uploads
sudo chown username:username /home/username/uploads
sudo chmod 755 /home/username/uploads
sudo chown root:username /home/username
sudo chmod 755 /home/username