Newbie Problem: Stuck at /etc/hosts. "Permission Denied".

Hello,
I started Linode in the hopes of trying to host a website.
I am following the guide and am currently stuck at the
"set the hostname" section.

I can set the hostname, but i seem to have difficulty accessing /etc/hosts. I type in

/etc/hosts

but the prompt shows "Permission Denied" sadly.

and i also have no idea how to edit the host file in a word editor as the tutorial suggests. figuring this out one at a time.

Problem: Why does it say permission denied? how do i proceed to add my linode public address and FQDN?

3 Replies

Greetings fellow Linodian, @gulhammer,

The Linode already has a public IP address assigned to it when it is created. You can find this in the 'Remote Access' tab.

To test if you have set the hostname correctly, you can run:

$ hostname

You're most likely getting the permission denied error because you need to be root or a super user to access that file. If you are running Ubuntu, you can add your user to the sudoers file like so:

$ adduser your-username sudo

Then you have the privileges to edit the file. In the example below we are using nano because it is simple to use.

$ sudo nano /etc/hosts

If nano is not already installed you can run the following:

$ sudo apt-get install nano

Best,
Preston
Linode Support Team

I chose ARCH Linux.
Hostname got me my…well…host name.

but

adduser my-username sudo

didnt get me anywhere though.
It mentions

command not found

What are the commands for Arch Linux to add a superuser so i can edit my etc/hosts file?
and
How would i be able to add an Fqdn?

I tried

sudo nano /etc/hosts

and get

Static table lookup for hostnames.
See hosts(5) for details.

What are the commands for Arch Linux to add a superuser so i can edit my etc/hosts file?

It seems that you already in the sudoers file, so you don't really need to change anything else.

The following:

# Static table lookup for hostnames.
# See hosts(5) for details.

Is the content of the file, they're just comments to help you, you can delete them or write below those lines.

I would suggest you to read the Arch wiki instead, guides here about Arch Linux while they're helpful, are not always updated.

References:

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct