How to Resolve "Permission Denied" Issues When SFTP File Uploading to a Bitnami Server

You're not alone if you've ever attempted to upload a file to your Bitnami server using SFTP and run into the dreaded Permission denied
error. When the person you're connecting as lacks the required write rights for the target directory, this problem frequently occurs. To help you troubleshoot and resolve this issue so you may resume your job, here is a simple instruction.
#
Recognizing the IssueUsually, the error looks something like this:
This occurs because your SFTP account lacks write permissions to the directory you're attempting to upload to, which is held by a user (or group). This is particularly typical for WordPress or other application-related folders on Bitnami servers.
#
First step: Verify Permissions
Go to the target directory first by SSHing into your server. To check its permissions, use the ls -ld
command:
This is what you'll see:
In this instance, root
is the owner of the directory, and only the owner is able to write. Your upload failed because of this.
Learn more about Linux file permissions
#
Second Step: Modify Permissions TemporarilyYou can let anyone write to the directory if you don't mind temporarily lowering the directory permissions:
Next, use SFTP to upload your file:
Revert the permissions to a more secure level after the upload is finished:
scp
with sudo
#
Step 3: Use 
Another choice if you don't want to change the directory permissions is to upload the file to a temporary directory, such as /tmp
, using scp
(secure copy), and then use sudo
to move it to the target directory.
/tmp
:#
Transfer the file to #
Move the file to the target directory:#
Best PracticesUse the Least Privileges Required: To avoid security issues, always reverse directory permissions after finishing an operation.
Verify Control: If this is a routine task, think about giving the Bitnami user control of the directory:
Automate Using Scripts: If you frequently perform this task, a straightforward script can help you save time and effort.
Bitnami Documentation has additional guidance on managing permissions effectively.
#
ConclusionThat's it! You may easily upload your files and get around the Permission denied
problem by changing permissions or by utilizing scp
with sudo
. This technique is applicable to any Linux-based system with comparable permission problems, not just Bitnami servers.
If you're looking for cloud deployment, check out what Oikos by Nife has to offer.