CentOS 7.4 SFTP 설정

2019/06/17 20:37
1. sftp user creation
  • 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}










Trackback

Trackback Address :: http://www.yongbi.net/trackback/847

Comments

What's on your mind?

댓글 입력 폼
[로그인][오픈아이디란?]
오픈아이디로만 댓글을 남길 수 있습니다