PINE64
How to modify HOSTS file - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PINE A64(+) (https://forum.pine64.org/forumdisplay.php?fid=4)
+--- Forum: Android on Pine A64(+) (https://forum.pine64.org/forumdisplay.php?fid=5)
+--- Thread: How to modify HOSTS file (/showthread.php?tid=3209)



How to modify HOSTS file - rvalecruz - 02-01-2017

I am trying to modify the "hosts" file so my Pine64 can be identified on my network with something other than "localhost".  However, when I bring up the file properties, there is no Change button to allow me to change the permissions.  Ideas?


RE: How to modify HOSTS file - MarkHaysHarris777 - 02-02-2017

(02-01-2017, 07:34 PM)rvalecruz Wrote: I am trying to modify the "hosts" file so my Pine64 can be identified on my network with something other than "localhost".  However, when I bring up the file properties, there is no Change button to allow me to change the permissions.  Ideas?

hi , the answer to your question can be complicated , and depends on your network setup;  whether you have a domain name server, and some other factors.  Basically, try the following in a terminal:

sudo -i

hostname  yournewname

( then use your editor of choice and edit  /etc/hosts )   I prefer vi, you might like nano or pluma:

vi  /etc/hosts

( leave the loopback alone:   127.0.0.1  localhost )

( add or change the line:  127.0.1.1  yournewname )

-----------------------------

The other machines on your network need to be able to resolve yournewname to the machines ip address, and you do that by either 1) adding the machine to your domain name server, or 2) editing each machine's /etc/host file with a line matching the ip address and yournewname.

note: as you use your terminal and logon and logoff of sudo -i  you will get an error "unable to resolve name"  until you add the second loop line in  /etc/hosts   127.0.1.1  yournewname

note: obviously , for this to work your machine must have 1) either a static IP address, or 2) a reserved address issued by dhcpcd.