I've opened an Ubuntu instance in EC2. I've installed Lamp environment and wanted to test it.

I want to use SFTP to access it. In my security group, I've opened port 22 (SSH, it is the default option that I haven't modified it.

Tried this:

When I get into nautilus I can't access it. I've tried:




I keep getting: Don't have permission to access the requested location.

Tried also this:

I've also tried opening the folder using nautilus from the terminal. So I've installed nautilus (sudo apt-get install nautilus) and then I tried nautilus .

All I get is:

(nautilus:16407): Gtk-WARNING **: cannot open display:

And tried this too:

So, after that, I've tried this solution: I've added the public key using the console in my local environment:

ssh-add /location_to_the_key_file/xxxxxx.pem

And I did access the folders remotely using sftp://ubuntu@myPublicIP.

BUT, I cannot upload anything due to a permission problem, because it seems that I only have reading permission. How may I change that?

What am I doing wrong? Thanks!!

  • What folder are you trying to write to on the server? Does the user (the one you're logging in as on the server) have write permission to that folder, or do they need to use sudo before being able to modify the contents? – user533208 May 8 '16 at 15:33

Found the answer, and it's here.

In a nutshell, you have to set the directory permissions:

Create a new www group and assign your ubuntu user to it:

sudo groupadd www
sudo usermod -a -G www ubuntu

Change the group ownership and directory permissions:

sudo chown -R root:www /var/www
sudo chmod 2775 /var/www
find /var/www -type d -exec sudo chmod 2775 {} \;
find /var/www -type f -exec sudo chmod 0664 {} \;

For it to work you have to log out and log in again after that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.