Install And Configure SFTP Failed!

Hello,

I think i did it correctly but it was marked failed :

1 - useradd kirsty
2 - passwd kirsty
3 - mkdir -p /var/www/data
4 - chown root:root /var/www
5 - chmod 755 /var/www
6 - chown kirsty:kirsty /var/www/data
7 - vi /etc/ssh/sshd_config
8 - I add in the bottom of the file :
Match User kirsty
ForceCommand internal-sftp
PasswordAuthentication yes
ChrootDirectory /var/www/data
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no

9 - systemctl restart sshd
10 - When i did ssh kirsty@stapp03 i receive :
thor@jump_host /$ ssh kirsty@stapp03
kirsty@stapp03’s password:
packet_write_wait: Connection to 172.16.238.12 port 22: Broken pipe
11 - When i did sftp kirsty@stapp03 i receive :
thor@jump_host /$ sftp kirsty@stapp03
kirsty@stapp03’s password:
packet_write_wait: Connection to 172.16.238.12 port 22: Broken pipe
Couldn’t read packet: Connection reset by peer

Can someone tell me what did i did wrong please ?

Regards,
Zakaria

1 Like

Hello community,

Anyone please

Hi Zakaria,

You missed to append this line to the sshd_config file. Add this one too and restart the service, you will be done.

Subsystem sftp internal-sftp

Hi Zakaria,

you should have the line
Subsystem sftp internal-sftp
and also replace this instead of what you have

4 - chown root:root /var/www/data
5 - chmod 755 /var/www/data

those should match your chrootDirectory: /var/www/data

that should help you.

2 Likes

Thank you very much for your help.

Thanks, this was really helpful