- create the user
sudo adduser access
- assign a password to the new user
sudo passwd access
2. Create Directory for File Transfer
- create the directory for file upload
sudo mkdir -p /var/sftp/uploads
- establish the root user as owner
sudo chown root:root /var/sftp
- grant write permissions to the root user and read to the other users
sudo chmod 755 /var/sftp
- modify the owner of uploads to be the user access
sudo chown access:access /var/sftp/uploads
3. Restrict Directory Access
- restrict the access by the terminal to the user access
sudo vi /etc/ssh/sshd_config
- In the final part of the file, add followings
Match User access
ForceCommand internal-sftp
PasswordAuthentication yes
ChrootDirectory /var/sftp
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no
- Save the changes using the key combination
ESC + :wq
- apply the changes in SSH
sudo systemctl restart sshd
4. Verify SSH Connection
- SSH connection
ssh acces@{server_ip}==> The result is verified that the connection will be closed through SSH
- Use the sftp protocol
sftp access@{server_ip}
댓글을 달아 주세요
댓글 RSS 주소 : http://www.yongbi.net/rss/comment/847