Get your free beta license ↗
FTP, SFTP and SSH · OpenSSH

SFTP disconnects right after login

Last updated 30 Nov 2026
Summary

A customer's SFTP session closes at login, and OpenSSH logs fatal: bad ownership or modes for chroot directory "/home/USER" [postauth]. The customer's top folder must belong to root, and one command restores that ownership.

Symptoms

The SFTP client disconnects right after login with an error such as Connection reset by peer.

Check the sshd log with journalctl -u sshd on AlmaLinux or journalctl -u ssh on Ubuntu. It shows the following error.

Output
fatal: bad ownership or modes for chroot directory "/home/USER" [postauth]

Cause

SFTP confines each customer to /home/USER. The sshd service requires root to own that folder and every parent folder. Only root may have write permission on those folders.

Using chown to give the customer ownership of /home/USER breaks that requirement. This can happen when you run chown -R on the home folder. The customer's own files are in /home/USER/files.

Resolution

  1. Preview the changes UrbeStack would make.

    urbestack-home-repair --name USER --dry-run
  2. The preview lists a change for /home/USER from USER:root to root:root. Apply the repair.

    urbestack-home-repair --name USER
  3. The folder /home/USER now has ownership root:root and mode 0755. Log in over SFTP again.