I’m on Windows client and I’m just starting to use FileZilla to SFTP local files on a remote server .. an Amazon EC2 instance running Ubuntu.
On my windows client I have Putty Pageant running as source of public keys.
Now the problem I’m having must be very basic .. «permission denied» leading to failed transfers
Error: /usr/lib/nx/nxsetup: open for write: permission denied
Error: File transfer failed
I right click the target server directory to check read/write permissionbs.
The directories in both source (localhost) and target (EC2 instance) can be navigated by FileZilla.
I tried to set attributes read/write for the entire target folder
but I get this ..
Status: Set permissions of ‘/usr/lib/nx’ to ‘777’
Command: cd «/usr/lib»
Response: New directory is: «/usr/lib»
Command: chmod 777 «nx»
Error: set attrs for /usr/lib/nx: permission denied
I have tried going to target server to change permissions of target folder /usr/lib/nx
sudo chmd +w /usr/lib/nx/
Also I’ve tried WinSCP but get identical errors ..
Cannot create remote file ‘/usr/lib/nx/nxsetup’
Permission denied
Error code: 3
————————————-
What is the basic configuration I’m missing just to transfer files from A to B using SFTP?
I’ve tried running FileZilla in administrator mode.
Is this probably a problem of permissions at the server end (Ubuntu) rather than in FileZilla?
————————————-
Here is a copy of the log file .. (EC2 path edited)
2011-11-14 21:00:53 3056 3 Status: Connecting to ec2-xx-xxx-xx-xxx.eu-west-1.compute.amazonaws.com…
2011-11-14 21:00:53 3056 3 Response: fzSftp started
2011-11-14 21:00:53 3056 3 Command: open «ubuntu@ec2-xx-xxx-xx-xxx.eu-west-1.compute.amazonaws.com» 22
2011-11-14 21:00:54 3056 3 Status: Connected to ec2-xx-xxx-xx-xxx.eu-west-1.compute.amazonaws.com
2011-11-14 21:00:54 3056 3 Status: Retrieving directory listing…
2011-11-14 21:00:54 3056 3 Command: pwd
2011-11-14 21:00:54 3056 3 Response: Current directory is: «/home/ubuntu»
2011-11-14 21:00:54 3056 3 Command: ls
2011-11-14 21:00:54 3056 3 Status: Listing directory /home/ubuntu
2011-11-14 21:00:54 3056 3 Status: Calculating timezone offset of server…
2011-11-14 21:00:54 3056 3 Command: mtime «.bashrc»
2011-11-14 21:00:54 3056 3 Response: 1317454718
2011-11-14 21:00:54 3056 3 Status: Timezone offsets: Server: 0 seconds. Local: 0 seconds. Difference: 0 seconds.
2011-11-14 21:00:54 3056 3 Status: Directory listing successful
You can make a test-directory and chmod this so everyone can read and write in it.
mkdir test
chmod 777 test
Now you put a file in it with ftp and look what user and group needs access.
cd test
ls -l
Once you know username and group you either have to change ownership of the directories in which you want your ftp users to write or you can make the ftpuser part of the group who owns the directories.
chown :ftpgroup dir_to_write (you can add -R for recursive but do not do this on system dirs!)
or:
adduser ftpuser group_who_owns_directory
If you only want to write to the html dir I would probably add the ftpuser to the html group so you do not get conflicts between the different processes on ownership.
I have created a user and a group only for SFTP and when I try to transfer a file with Filezilla in /var/www
I have this error:
Open for write: permission denied
I have configured sshd_config
like this :
#Subsystem Sftp /usr/libexec/openssh/sftp-server
Subsystem sftp internal-sftp
Group sftp_only Match
ChrootDirectory /var/www
ForceCommand internal-sftp
X11Forwarding No
AllowTcpForwarding No
/var/www and sub directories are chown root:root
and chmod 755
SELinux is disabled.
Any idea ?
masegaloeh
18.2k10 gold badges57 silver badges106 bronze badges
asked Mar 3, 2015 at 16:08
1
The permission of /var/www
does not permit the chrooted-user to create files in it.
That is correct and by design.
You must create a folder inside of /var/www
with the proper rights of the user.
/var/www
can not be writeable for the user.
answered Mar 3, 2015 at 16:20
fakerfaker
17.5k2 gold badges60 silver badges69 bronze badges
I am trying to transfer files with Filezilla to the root directory (/usr/share/nginx/www) of my nginx VPS via SFTP. The data-transfer fails with the following error-message:
/usr/share/nginx/www/test.php: open for write: permission denied
I am not using the root user, but created a user with sudo-rights to access my server.
I already tried to get www-data
group permissions for my user with the following commands, however, without success:
sudo newgrp www-data
sudo usermod -a -G www-data myuser
Any idea how to get write permissions to transfer my files?
If you have aws instance virtual web server and it is running. Also want to transfer/upload files on ec2 aws web server using filezilla. So, you have Filezilla connected to the AWS server but when you try to move the files from my local machine to the /var/www/html directory on apache 2 aws, it displays permission denied.
You can see Amazon AWS Filezilla transfer permission denied error on following image:
So, in this post, we will show you simple way to enable the permission of your aws apache 2 ubuntu user. And you can easily transfer/upload file using filezilla on amazon aws apache 2 ubuntu web server without error.
Solution 1 – AWS Ubuntu – Enable File Transfer permission denied Filezilla
First of all, you need to connect your aws ec2 instance from ssh terminal. If you are new to connect aws ec2 instance with windows, ubuntu and mac system. So you can read this tutorial “How to Connect to ec2 Instance From Putty and SSH Terminal” to connect your ec2 instance from ssh. Otherwise you can see the how to enable write for permission denied.
Now, you can use the following command to enable write access to the public web directory (/var/www/html).
Important note, different types of users contain different user names for the Amazon AWS instance virtual web server. You can see the following table:
- Amazon – ec2-user
- Centos – centos
- Debian – admin or root
- Fedora – ec2-user
- RHEL – ec2-user or root
- SUSE – ec2-user or root
- Ubuntu – ubuntu or root
Now, connect your aws instance with ssh terminal. Then type the following command:
Aws centOs User
sudo chown -R centos:centos /var/www/html sudo chmod -R 755 /var/www/html
Aws Ubuntu User
sudo chown -R ubuntu:ubuntu /var/www/html sudo chmod -R 755 /var/www/html
AWS Amazon ami User
sudo chown -R ec2-user:ec2-user /var/www/html sudo chmod -R 755 /var/www/html
After that, type the following command on your ssh terminal:
chmod -R 755 /var/www/html
Thanks for reading this post, we hope this post is helpful for as to enable write permission on /var/www/html directory in aws virtual web server.
Recommended Tutorials
My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of Tutsmake.com. I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Python, Javascript, JQuery, Laravel, Livewire, Codeigniter, Node JS, Express JS, Vue JS, Angular JS, React Js, MySQL, MongoDB, REST APIs, Windows, Xampp, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL and Bootstrap from a starting stage. As well as demo example.
View all posts by Admin