How to fix “Permission denied” when trying to edit a file on aws server?

0

I have a PHP file on AWS linux server. The address is /var/app/***/a.php. When I try to edit the file using WinSCP, I get the permission denied error.

I tried to access the rights to edit using this command: chown -R root:root /var/app with and without sudo, but it didn't work. What should I do?

Gordafarid

Posted 2019-01-15T10:14:22.187

Reputation: 3

Try to edit file with sudo, e.g. sudo vim /var/app/***/a.php. – kenorb – 2019-01-15T12:15:25.523

Answers

0

The chown command you are using is setting the permissions to root:root so if you're following good practices and connecting via WinSCP with a non-root user (such as ubuntu), you should actually be using something like chown -R ubuntu /var/app which will change the ownership to that of you're day-to-day user.

v25

Posted 2019-01-15T10:14:22.187

Reputation: 176