Install And Configure SFTP - Doubts


I have some doubts concerning this task (Install And Configure SFTP - stapp01).


I tried following the path in the webpage:

#Create group sftpusers
sudo groupadd sftpusers

#Create dir for user
$ mkdir -p /var/www/nfsdata

#Create User - The following command creates yousuf, assigns this user to sftpusers group, make /incoming as the home directory,
set /sbin/nologin as shell (which will not allow the user to ssh and get shell access).
sudo useradd -g sftpusers -d /var/www/nfsdata -s /sbin/nologin yousuf
sudo passwd yousuf


id yousuf
cat /etc/group | grep sftpusers
cat /etc/passwd | grep yousuf


#Modify the the /etc/ssh/sshd_config file
sudo vi /etc/ssh/sshd_config file

#Subsystem sftp /usr/libexec/openssh/sftp-server (comment)
Subsystem sftp internal-sftp #(add)

#Specify Chroot Directory for a Group

tail /etc/ssh/sshd_config

Match Group sftpusers
ChrootDirectory /var/www/nfsdata
ForceCommand internal-sftp
PasswordAuthentication yes
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no

#Setup Appropriate Permission

chown yousuf:sftpusers /var/www/nfsdata


#restart service
sudo systemctl restart sshd

Problem is, I receive a “packet_write_wait: Connection to port 22: Broken pipe”


No matter what I do, I can’t use sftp. Can anyone help me with this issue?

Thanks in advance,
Pedro Magalhães

the same error comes to me as well.