Shared server guidance · Question & answer

Why does SCP or SFTP say permission denied when SSH works?

SSH authentication and file access are separate checks. An account can log in successfully while lacking permission to read a source or write a destination. Identify which path failed and which account owns it.

IntermediateWindows 11 with Microsoft OpenSSH Client; Windows PowerShell 5.1 or PowerShell 7 as labelledLinux VPS and dedicated servers where a remote Linux command is shown
Go to the answer

Instructions

1. Confirm the remote identity and directory

Run the check in the same account used by the transfer.

Remote Linux shell
whoami
pwd
ls -ld "$HOME" "$HOME/staging"

The staging path must exist if you intend to use it. Inspect the actual failing directory rather than assuming the home directory controls it.

2. Inspect the specific source or destination

Check the file and each relevant parent directory. Read access to a file is not enough if the account cannot traverse a parent directory. A read-only filesystem or quota limit can also prevent writes.

3. Choose an authorised writable target

For an upload needed by a protected application, first use an account-owned staging location, then follow the application’s approved deployment procedure.

Local Windows PowerShell
scp ".\report.txt" adminuser@203.0.113.10:report-staging.txt

This writes to the account’s home directory. Confirm the target filename does not already contain data you need.

Check the result

  • The selected account has the required access to the exact transfer path.
  • The file arrives in the intended authorised destination.

Troubleshooting

SFTP starts in a restricted directory
The account may be intentionally jailed. Use its assigned writable area and approved transfer scope.
A protected directory rejects uploads
Do not grant world-write permission. Use a controlled administrative deployment step after staging.

Official references

Use the documentation for your installed version when a flag, service name or platform feature differs.