"sudo: unable to resolve host ghost" + Directory Permissions 403 Error

Okay, well, I sort of went down the rabbit hole of errors, beginning by attempting to change my newly-made directory ownerships (/var/www/documents and /var/www/projects) to the point where I’m at in the question title above. For reference, I have read the related question, but all seemed fine on that front.

Changing Directory Permissions First, I visited this piece on GitHub and followed their instructions to chmod 701 user_home. Files I placed in my newly-made directories above would produced a 403 error—I couldn’t read them. If I do resolve the below, this problem still remains.

Unable to Resolve Host Since that, upon trying to sudo service nginx restart, I’ve been getting the above host resolution error. I’m running Ghost. Now, I have an ERR_CONNECTION_REFUSED, and nothing is loading.

Server + Site Information My /etc/hosts and /etc/hostname contents are below respectively. My droplet’s name is Dizaztrous.

/etc/hosts localhost.localdomain localhost localhost4.localdomain4 localhost4```

```::1 Dizaztrous Dizaztrous
::1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6```


My site is []( The realm of server-side maintenance is something I've been barely scraping by with, and it's finally hit me now. I'll be happy to answer any questions you may have, as I'm at a bit of a loss with my site down. Thank you!

Sorry, I'm a bit lengthy—tried to change directory permissions and ended up downing my entire website.**

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.


First up, just for the sake of keeping “junk” out of your /etc/hosts file, the entries below can be safely removed as they do nothing at all :-). Dizaztrous Dizaztrous
::1 Dizaztrous Dizaztrous

If you’re not specifically using IPv6, you can remove the rest of the IPv6 too:

::1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6

In fact, the only thing you really need to define in that file is your hostname with and without your domain attached and localhost, like so:       localhost hostname

If you’re not sure what your hostname is, you can execute the following from the CLI:


… and it’ll output what you currently have it set as. If you’d like to change it, you can use the same command and pass a new hostname to it.


With that out of the way, directories should be chmod 755 and files chmod 644, though setting up these permissions won’t do any good unless your directories are owned by the user who’s executing the scripts (read: files) from said directories.

Note: For the next bit, I’d recommend heading over to PasteBin and copying the requested information to a new PasteBin for each, just to keep things organized :-).

Browse to your home directory, execute the command below and save it to a PasteBin. This command simply lists the files and directories in the directory you run it from and tells us who owns them and what their permissions are set to.

ls -al

Next, if you would, please post the contents of:




Where yoursite.conf is the configuration file for your website (note: you may use another directory to store configuration files – this is the default, so please feel free to substitute as needed :-) ).

I’m mainly looking to see who you’re running NGINX as and to also make sure everything in both the NGINX configuration file and your website configuration file looks good so perhaps we can knock out two things at once :-).

Alright, so permissions of 701 is very weird. By default in Linux systems, file permissions are 644 and directories 755. But 701 basically says anyone can execute but only that user can do everything. Very insecure to have a file with a 7 in the permission when you don’t need it (or a 1 for that matter). Basically, how you want to go about this is change those permissions back to the defaults (when they were originally created, they might’ve not all been the Linux defaults).

Going from there, it depends on what your running. Could you give me an idea so I know what specific permissions sound good for it?

More information and a handy tool to learn octal “number” permissions.