$ sudo apt-get install ssh-server -y
sshd_config
/etc/ssh/sshd_config
$ sudo vi /etc/ssh/sshd_config
#Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp internal-sftp
Match group ftpaccess
ChrootDirectory %h
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
$ sudo systemctl restart ssh
$ sudo addgroup sftp
$ sudo useradd -m sftpUser -g sftp
eg. create user is
sftpUser
and assign tosftp
group
$ sudo passwd sftpUser
...
New password:
Retype new password:
passwd: password updated successfully
$ sudo chmod 700 /home/sftpUser # /home/<username>
All Done
$ sftp sftpUser@<ip or hostname>
if your has the same problem as below
$ sftpUser@<ip or hostname>: Permission denied (publickey).
Connection closed
Connection closed.
sshd_config
/etc/ssh/sshd_config
PasswordAuthentication no
# to
PasswordAuthentication yes
$ sudo systemctl restart ssh
$ sftp [email protected]
[email protected]'s password:
Connected to xx.xx.xx.xx.
sftp>