“SFTP Permission denied” can mean three different things: SSH authentication failed, a remote file operation was rejected, or the SFTP subsystem could not start. The correct fix depends on when the error appears and whether you are uploading (put) or downloading (get).
If you can connect and list files, do not immediately edit sshd_config. Check the remote account, target path, directory permissions and file ACLs first. If SFTP closes before a prompt, examine the server’s SFTP configuration and logs.
| Where it fails | Likely area to investigate | Read next |
|---|---|---|
Before login: Permission denied (publickey) | SSH authentication, not file permissions | SSH login checks |
put / create / overwrite fails | Remote write permission, ownership, ACL or policy | Upload failure |
get fails | Remote file read/parent execute permission or local destination | Download failure |
| SSH works, SFTP session cannot start | Subsystem, Match, ForceCommand or chroot | Subsystem checks |
First: Identify the Exact SFTP Error
OpenSSH SFTP is carried over SSH, but logging in and performing a filesystem operation are different stages. A successful SSH handshake does not give you write access everywhere on the server.
| Observed message | What it tells you | First check |
|---|---|---|
Permission denied (publickey) | SSH authentication failed before SFTP began | Username, SSH key and server authentication policy |
remote open(...): Permission denied during put | The server could not open the remote destination for writing | Parent directory and existing file permissions |
Couldn't create directory: Permission denied | The server rejected directory creation | Write and execute permission on the parent |
Couldn't get handle: Permission denied during get | The requested remote file could not be opened for reading | Read access on the file and traversal of parent directories |
Couldn't close file | A close/finalization operation failed; not always a chmod issue | Verbose client log, disk/quota and server log |
Connection closes before sftp> appears | Session/subsystem startup may have failed | SSH verbose output and sshd server log |
The wording differs among OpenSSH, WinSCP, FileZilla and graphical clients. Avoid choosing a fix solely from an error code: confirm the attempted operation and exact remote path.
Permission Denied (publickey): Authentication Never Succeeded
If you see Permission denied (publickey) before the sftp> prompt, the server did not accept the SSH credentials. That is not an upload or download permissions problem. Check that your SFTP client uses the intended username, host, port and private key.
sftp -vvv -i ~/.ssh/id_ed25519 [email protected]
# Compare with an ordinary SSH login to the same host:
ssh -vvv -i ~/.ssh/id_ed25519 [email protected]
In Windows PowerShell, use sftp -vvv -i "$env:USERPROFILE\.ssh\id_ed25519" [email protected], replacing the key and host with your own. On Linux and macOS, ~/.ssh/id_ed25519 is the usual example path. An SFTP-only account may intentionally reject interactive shells, so a failed shell session is not itself proof of failed SSH authentication; inspect the verbose authentication result. Our SSH permission denied (publickey) guide covers keys, ownership of authorized_keys and authentication policy in depth.
SFTP Upload Permission Denied: Fix put, mkdir and Overwrites
The most common upload scenario is straightforward: your SFTP account can list a directory but cannot create files there. For example, a root:root directory with mode 755 is readable and traversable by other users, but only its owner can create entries.
sftp> put report.txt /srv/shared/report.txt
Uploading report.txt to /srv/shared/report.txt
remote open("/srv/shared/report.txt"): Permission denied
Creating a new file requires write and execute permission on its parent directory. Overwriting an existing file can depend on the file’s write permission; applications that upload a temporary file and rename it also require directory permissions. Check which operation your client performs rather than assuming all uploads behave identically.

put into a root-owned directory. The server rejects the upload; this is not an SSH login failure.On a Debian/Ubuntu server, inspect the parent directory and user identity. Replace the sample paths with the actual failed destination:
id sftp_user
namei -l /srv/shared
ls -ld /srv/shared
ls -l /srv/shared/report.txt # if it already exists
Do not use sudo chmod -R 777 to make the upload succeed. Instead, use an approved user-owned upload directory, a suitable shared group, or a narrowly scoped ACL. See the safe-fix examples below.
SFTP Download Permission Denied: Fix get and File Read Access
A successful ls does not prove the remote account can read a specific file. The directory may permit listing while the file is readable only by its owner or group. This is why an SFTP get can fail even when you can browse to the file.
sftp> get /srv/shared/private.txt
Fetching /srv/shared/private.txt to private.txt
remote open("/srv/shared/private.txt"): Permission denied
For a remote download, the account typically needs read permission on the file and execute/search permission on each parent directory. Check the remote object, not just the download folder on your own computer:
id sftp_user
namei -l /srv/shared/private.txt
ls -l /srv/shared/private.txt
getfacl -p /srv/shared/private.txt # if ACL tools are installed
If the remote permissions are correct but get still fails, check the local destination as well. Inside interactive SFTP, use lpwd to see your local working directory and lcd to change it. A local write error and a remote permission denial require different fixes.

get is refused because the test file is mode 600 and owned by another user.Do not make private files world-readable to solve this. Ask the file owner or administrator to grant the correct user/group access to the specific content that should be shared.
Check Linux Ownership, Parent Directories, ACLs and Symlinks
ls -l is useful, but it only shows one component of a path. A directory higher in the tree can deny traversal even when the file itself looks readable. Symlinks can also point into a directory that the SFTP user cannot access.
# On the server (replace examples with real account and path):
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
In namei -l output, examine each component, not just the last line. A missing execute bit on a directory can block access to everything below it. The getfacl command can reveal ACL entries and an effective mask that explain access not obvious from basic mode bits. It may require installing the acl package.

root, so the test SFTP account can traverse it but cannot write inside it. The separate upload directory belongs to the test user.Also check whether a service account, container volume, network filesystem or mandatory access-control policy (for example SELinux on some systems) applies. A successful touch inside an interactive SSH shell does not prove an SFTP client targets the same resolved path or uses the same write/rename sequence.
SSH Works but SFTP Does Not: Check the Subsystem and Session
If an interactive SSH shell works yet SFTP disconnects before you can run ls, diagnose session startup rather than changing ordinary directory permissions.
# Client — show SFTP/SSH diagnostics:
sftp -vvv [email protected]
# Server — read-only checks (Debian/Ubuntu):
sudo /usr/sbin/sshd -t
sudo /usr/sbin/sshd -T -C user=user,host=server.example.com,addr=192.0.2.25 | grep -Ei '^(forcecommand|chrootdirectory|authenticationmethods) '
sudo grep -RniE '^[[:space:]]*(Subsystem[[:space:]]+sftp|Match[[:space:]]|ForceCommand|ChrootDirectory)' /etc/ssh/sshd_config /etc/ssh/sshd_config.d/
The -C values must reflect the actual connection for Match rules to be evaluated meaningfully; the example client IP is reserved for documentation. sshd -t validates syntax, but it cannot guarantee that a particular user can start a session. Inspect server logs at the time of the failure.
sudo journalctl -u ssh --since "15 minutes ago" --no-pager
# On distributions naming the unit sshd:
sudo journalctl -u sshd --since "15 minutes ago" --no-pager
Check whether Subsystem sftp points to a working implementation, and whether a user/group-specific Match or ForceCommand changes the result. A restricted internal-sftp account may not have an interactive shell by design; that is not necessarily an error.
ChrootDirectory Permission Denied: The Root-Owned Jail Rule
A chrooted SFTP account sees a virtual root directory. The directory specified by ChrootDirectory and each pathname component leading to it must be owned by root and not be writable by group or others. A violation can prevent the SFTP session from starting at all.
# Example OpenSSH SFTP-only policy (illustrative; do not paste
# into a production sshd_config without reviewing the user/group):
Match User alice
ChrootDirectory /srv/sftp/alice
ForceCommand internal-sftp
DisableForwarding yes
Inside that chroot, the writable directory should be a separate subdirectory. The user must not be able to modify the chroot root itself:
# Example layout for an authorized administrator:
# First inspect ALL parent components; do not chown shared directories.
namei -l /srv/sftp/alice
# Only for a dedicated jail directory you administer:
sudo chown root:root /srv/sftp/alice
sudo chmod 755 /srv/sftp/alice
sudo install -d -m 700 -o alice -g alice /srv/sftp/alice/upload
# Verify every component:
namei -l /srv/sftp/alice
The chroot path and every parent component must satisfy OpenSSH ownership rules. If a shared parent directory does not, use an appropriate dedicated chroot location rather than changing ownership of a directory used by other services. Never run recursive ownership changes across production files to repair one SFTP account.
OpenSSH documents the requirement in sshd_config(5). Our SFTP server setup guide covers planning a restricted account and its directories.
Fix SFTP Permissions Safely, Then Verify the Transfer
Start with the least-privileged change that matches the required workflow. A shared upload location often needs only one writable subdirectory; there is rarely a reason to open an entire webroot or chroot tree to everyone.
| Problem | Safer approach |
|---|---|
| New upload cannot be created | Use a designated directory owned by the SFTP account, or grant a trusted group write+execute access |
| Existing file cannot be overwritten | Review ownership and file mode as well as client temp-file/rename behavior |
| One file cannot be downloaded | Give the appropriate user/group read access, without exposing private files globally |
| Shared group workflow | Use group ownership/setgid or targeted ACLs with administrator approval |
| Chroot startup fails | Keep jail root owned by root, put user-owned upload/ inside |
For example, an administrator can create a new, dedicated directory owned by an approved SFTP account:
sudo install -d -m 700 -o sftp_user -g sftp_user /srv/sftp-uploads
# Verify as that user or through SFTP, then transfer a harmless test file.
Do not copy the example if sftp_user is not a real local account, if the chosen path is inside a restricted chroot with a different ownership model, or if the server is managed by someone else.

For verification, repeat the exact operation that failed: put for upload, get for download or mkdir for directory creation. A successful login alone does not confirm the permissions are fixed.
WinSCP, FileZilla, MobaXterm and ShadeTerm: Same Server Permissions
Graphical clients often display the same server-side failure with slightly different language. WinSCP may show Permission denied and SFTP status code 3; FileZilla may say open for write: permission denied. The text is diagnostic, but the cause must still be verified on the server.
When a GUI transfer fails, reproduce it with sftp user@host using the same username, port, remote path and key. If both fail, focus on server-side access. If only the GUI fails, compare its overwrite/rename behavior, remote path, transfer options and actual identity.
# OpenSSH SFTP uses uppercase -P for a nonstandard port:
sftp -P 2222 -i ~/.ssh/id_ed25519 [email protected]
In Windows PowerShell, use a path such as "$env:USERPROFILE\.ssh\id_ed25519" with the -i option. The ~/.ssh example above is for Unix-like shells. ShadeTerm combines an SSH terminal and SFTP browser in one server workspace, allowing you to inspect directory paths while troubleshooting. It cannot bypass server permissions.
Still Denied? Read-Only Mounts, Quotas, SELinux and AWS Transfer
Not every failed transfer is a Unix mode-bit error. Once owner, group, ACL and pathname are correct, verify the actual filesystem and server policy:
findmnt -T /srv/sftp-uploads
df -h /srv/sftp-uploads
# Where user quotas are enabled:
quota -s sftp_user
On Linux, a read-only mount, full volume or exceeded quota may block writes. The returned SFTP message may differ from Permission denied, so use logs and error details rather than attributing every failure to these causes. SELinux or AppArmor can also restrict an operation even where discretionary file permissions allow it.
AWS Transfer Family backed by S3 has a different permission model. Check the Transfer Family user's IAM role, role trust policy, logical directory mapping and bucket/prefix policy; chmod on a Linux VPS cannot change S3 access rules. See the AWS Transfer Family user documentation.
SFTP Permission Denied FAQ
Why can I SSH into the server but not upload with SFTP?
SSH login establishes identity, not universal filesystem write access. Inspect the destination directory, the existing file (when overwriting), ACLs and the client's transfer method. If SFTP cannot even start, inspect the subsystem and Match configuration instead.
Why can I list a file but cannot download it?
The containing directory may allow listing while the file denies read access. Check ls -l, namei -l and getfacl as the connecting user. Also confirm that the local download directory is writable.
Will chmod 777 fix SFTP permission denied?
It may allow unintended writes and can break a chroot setup. Use a designated user/group-owned directory or a narrowly scoped ACL instead. Never recursively chmod an entire server directory just to make SFTP work.
Does SFTP permission denied mean my SSH key is broken?
Only when the failure is during authentication, for example Permission denied (publickey). If you reach an sftp> prompt and put or get fails, your SSH identity was already accepted.
Which logs should I check on Debian?
Try sudo journalctl -u ssh near the failed attempt. Depending on OS and logging configuration, the unit may be sshd or messages may also appear in authentication logs.
Sources and Further Troubleshooting
These references cover the SFTP client, server-side configuration and real-world permission symptoms. The diagnostic commands above are Linux/OpenSSH examples; confirm your server's distribution and access policies before changing anything.
- OpenSSH sftp(1): client commands and flags
- OpenSSH sshd_config(5): Subsystem, Match, ForceCommand and ChrootDirectory
- OpenSSH sftp-server(8): subsystem behavior
- Linux namei(1): path component and symlink diagnostics
- Server Fault: SSH works, SFTP write rejected
- Stack Overflow: SFTP get rejected by file read permissions
- Super User: SFTP-only accounts and chroot permissions
Bottom line: locate the failing stage, check the exact remote path and identity, then change only the permission or server setting responsible. A successful, repeatable put or get is the real test of the fix.