11

I have an Ubuntu server on Amazon, I installed everything for working with it (php, mysql, phpmyadmin, apache..), The problem is that I cant move around or edit files using the FTP.

I get the error message:

Permission denied.
Error code: 3
Error message from server: Permission denied

from my WINSCP.

The only way I can trancefer/edit file is using 'putty' with the sudo/nano command.

I found a lot of information about this on google, but there are no updated soulution I can find. Linux isn't my usual work-space.

How do I get the permissions working for the WINSCP ?

Imnotapotato
  • 5,308
  • 13
  • 80
  • 147

5 Answers5

18

A lot of answers say to change permissions on /var/www/ ... however AWS shortcuts out of the WWW folder and into the /var/app/current/ directory. If all else fails try:

sudo chown -R -v ec2-user /var/app/current/
Keith C.
  • 365
  • 1
  • 5
  • 15
2

On Ubuntu image in AWS, default user is ubuntu. Instead of using system folders like /var/... better to use /home/your_folder. Then change the ownership using {chown} command. For eg.

$ sudo chown -R -v ubuntu /home/your_folder/

This will change the ownership of 'your_folder' and contents inside it from 'root' user to 'ubuntu'. Then Winscp should be able to upload/delete/create files using SFTP/FTP etc..

userAbhi
  • 695
  • 6
  • 10
1

I had the same issues. The solution is: You can solve this by changing WordPress ownership type:

sudo chown -R www-data:ubuntu /var/www/wordpress

Then, Change the right permission for the particular files and directories, type command

sudo find /var/www/wordpress/ -type d -exec chmod 755 {} \;
sudo find /var/www/wordpress/ -type f -exec chmod 644 {} \;

Apart from this, set the following important files to chmod 600 so that only the owner can fully read and write access to these files:

sudo chmod 600 /var/www/wordpress/wp-config.php
sudo chmod 600 /var/www/wordpress/.htaccess

Then everything will work. You will be able to access your wordpress files

Acadawall
  • 11
  • 2
1

for me using free tier from cloud providers will not give you root access, to fix this you have to change folder permission from SSH or try this solution

OS: windows 10 Pro

Open WinSCP instead of SFTP you select SCP go to advance settings click on SCP/Shell and change the shell option to sudo su -

Now you will be able to get permission.

Subramanya Rao
  • 151
  • 3
  • 6
-2

Change file permision by command chmod 777 /var/app/current/ and transfer files to the directory