Install And Configure SFTP

sftp siva@stapp01 fails with below error

write_wait: Connection to 172.16.238.10 port 22: Broken pipe

Couldn’t read packet: Connection reset by peer

Below are configured
useradd siva -d /var/www/appdata -s /sbin/nologin

passwd siva

/etc/ssh/sshd_config details
Match User siva
PasswordAuthentication yes
ChrootDirectory %h
AllowTCPForwarding no
X11Forwarding no
ForceCommand internal-sftp

retstarted sshd using systemctl restart sshd

Details of user
[root@stapp01 ~]# id siva

uid=1002(siva) gid=1002(siva) groups=1002(siva)

[root@stapp01 ~]# cat /etc/passwd | grep siva

siva:x:1002:1002::/var/www/appdata:/sbin/nologin
Permission for /var/ww/appdata

755, and siva user and group added as owner

you have to give ownership appdata directory to as root , to resolve that broken pipe error.

Thank you it helped to fix the issue. I’m able to do sftp