An SFTP transfer can fail even when you can connect to the server. That’s because SSH authentication, starting an SFTP session, and reading or writing a remote file are separate steps. The error’s timing—and whether you were uploading or downloading—usually tells you where to look.

Before changing permissions, note the exact message, the remote path, and the operation that failed. Avoid broad fixes such as chmod -R 777: they can expose files and create new problems, especially on restricted SFTP accounts.

Locate the failing step

Try connecting with OpenSSH’s verbose output. These commands work from a Unix-like shell; Windows PowerShell also includes OpenSSH on supported systems.

sftp -vvv user@server.example.com 

If you cannot authenticate and see Permission denied (publickey) before an sftp> prompt, investigate the username, host, port, key, and server authentication policy. That’s an SSH login failure, not a remote file-permission error. The SSH publickey troubleshooting guide goes deeper into rejected keys and authentication checks.

If you reach the SFTP prompt and can run ls, authentication succeeded. A failed put or get is more likely about access to the requested file or directory. If the connection closes before the prompt appears, the SFTP subsystem or a user-specific SSH rule may be preventing the session from starting.

Check the operation and the path

For an upload, creating a new file requires write and execute permission on its parent directory. Overwriting an existing file can depend on that file’s permissions too. Some clients upload a temporary file and rename it, which can also require permissions on the directory.

For a download, the account generally needs read access to the remote file and execute (search) permission on each directory in its path. Being able to list a directory does not prove you can read every file inside it.

At the SFTP prompt, check your remote location and listing:

pwd ls -la 

Then reproduce the failed action with the exact path. For example:

put report.txt /srv/shared/report.txt get /srv/shared/private.txt 

A graphical client may show different wording for the same server response. If you compare with the command-line client, use the same account, key, port, and remote path. A difference can point to client behavior such as temporary-file uploads or renames.

Inspect permissions on the server

If you administer the Linux server, inspect the account and every component of the path. These are server-side shell commands, not commands to type at the sftp> prompt:

id sftp_user namei -l /srv/shared/uploads/report.txt ls -ld /srv/shared /srv/shared/uploads ls -l /srv/shared/uploads/report.txt getfacl -p /srv/shared/uploads/report.txt 

Replace the sample account and path with the ones involved in the failed transfer. namei -l helps reveal a parent directory that blocks traversal even if the final file’s mode looks correct. getfacl can show access-control entries not apparent from ordinary mode bits; it may require ACL tools to be installed.

If you don’t administer the server, ask its administrator to run these checks. Don’t assume that a directory is writable because it appears in a listing, and don’t make private files world-readable to make a download succeed.

Choose a narrow fix

For a dedicated upload location, an administrator might create a directory owned by the SFTP account:

sudo install -d -m 700 -o sftp_user -g sftp_user /srv/sftp-uploads 

Use this only if the account and path are appropriate for your server. Shared workflows may need group permissions or a targeted ACL instead. Give access only to the user or group that needs it, and verify the specific put, get, or mkdir operation that originally failed. A successful login alone doesn’t confirm that file access is fixed.

For an SFTP-only account in a chroot, the jail has additional requirements: the chroot directory and each component leading to it must be owned by root and not writable by group or others. Put writable files in a separate directory inside the jail rather than making the jail root writable. Don’t change ownership of shared parent directories to satisfy this rule.

If SSH login works but SFTP never reaches its prompt, ordinary file permissions may not be the issue. Check the server’s SFTP subsystem configuration, applicable Match or ForceCommand rules, and logs around the failed connection. The Linux SFTP server setup guide covers server configuration and restricted-account directory layouts.

If permissions look right

Access can also be affected by ACLs, symlinks, a read-only filesystem, disk space, quotas, or security policy such as SELinux or AppArmor. For a Linux server, an administrator can inspect the filesystem and available space:

findmnt -T /srv/sftp-uploads df -h /srv/sftp-uploads quota -s sftp_user 

The quota check applies where user quotas are enabled. If the remote path and permissions seem correct, use the verbose client output and server logs to narrow down what the server rejected rather than repeatedly changing mode bits.

For AWS Transfer Family backed by S3, Linux chmod is not the solution: access depends on the user’s IAM role, directory mapping, and bucket or prefix policy.

The useful habit is to identify the stage first, then check the exact account and path. Change only the permission or server setting needed, and confirm the fix by repeating the transfer that failed.

I originally published a more detailed version of this guide on the ShadeTerm blog.

I'm also building ShadeTerm — an SSH client where every server gets its own workspace for terminals, SFTP, code, and databases.