Get permission to work with files on my Amazon EC2 Ubuntu server using FTP-WinSCP
Asked Answered
W

5

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 ?

Whitmer answered 1/2, 2015 at 9:56 Comment(0)
D
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/
Depict answered 7/12, 2015 at 3:9 Comment(1)
better answer than most found elsewhereUnctuous
M
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..

Millenarianism answered 16/8, 2019 at 11:11 Comment(0)
H
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

Hilde answered 21/7, 2020 at 2:51 Comment(0)
G
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.

Gristle answered 14/10, 2022 at 9:14 Comment(0)
C
-2

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

Cynic answered 16/6, 2019 at 14:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.