I am getting Unable to save file: Permission denied in atom when saving running ubuntu

Try running:

sudo chown -R username:www-data /path/to/directory

"username" being what gets spit out when you enter

whoami

Digital Ocean's tutorials are pretty good for installing stuff the right way. I got the above from https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lamp-on-ubuntu-16-04


This isn't an atom problem, it's a linux permissions problem.

You opened a file owned by another user (a file probably owned by root). If you want to edit that file, you have to either be root or change the permissions on the file to grant other users access.

Usually the best solution is to temporarily become root and edit the file:

sudo atom /path/to/file

This is because of linux permissions. The best way to solve this problem is by providing permission for the user. This can be done by chown command.

sudo chown -R username:groupname directory

You can find your username using whoami command and your group name by using groups username command.

Let's say you got "john" as your username. To get groupname you run the command

groups john

You will get an output something like this

john : john staff adm cdrom lpadmin admin

The first name after : is your primary group. In the example it is "john"

The command will be

sudo chown -R john:john /opt/lampp/htdocs