Transferring files through SFTP

1

When I try to upload files to my server I am getting a permission denied error. I am able to see all the files through filezilla and even download them but when I try to upload it doesn't let me. I also can't create directories. I have checked the file permissions and made sure port 22 is open. What would be causing me to not be able to upload the files?

I have this setup on Google Compute Engine and implemented a LAMP system. I have also tried to put files and create directories through the ssh terminal but get the same permission denied error. However, I am able to edit files with the sudo nano command.

I found I can only upload to a home folder that is listed, home/username. How do I add permissions for other folders like var/www?

Michael St Clair

Posted 2014-10-08T13:58:33.333

Reputation: 145

Answers

2

If the only editing you've been able to do is a) through sudo, and b) in the home folder, you are using a non-root user. That's a good thing, but it means you'll run into exactly these constraints. If you want to upload directly to /var/www without being root, you could adjust the ownership or permissions on that folder, like this:

sudo chown $USER /var/www

Or, you can just upload files into the home folder, and then copy them into place through the interactive session:

sudo cp -p ~/newfile.html /var/www/

The key is that you'll need to use sudo to make changes that aren't allowed otherwise.

Nick Russo

Posted 2014-10-08T13:58:33.333

Reputation: 979

thank you so much! I am new to this and was searching for this answer for hours yesterday! – Michael St Clair – 2014-10-08T14:08:55.177

Wow 8 hours in and I finally stumble on your answer. Thank you so much – Tony Brix – 2015-04-05T05:06:27.100