0

I am new on unix systems, I want to ask about the hosts file that is in /etc/hosts what does used for ?? also I want to ask that when connect using ssh=> I wrote on hosts file the following x.x.x.x (server IP) server.hostname

and when use ssh root@server.hostname it says that Unable to resolve host 'server.hostname': Connection failed.

storm
  • 4,973
Ibra.MAz
  • 1
  • 1
  • 3
    If you're looking for a convenient way to map hostnames to IP addresses for SSH, I'd suggest using your ~/.ssh/config file instead – steeldriver Sep 13 '15 at 14:04

1 Answers1

0

As your machine gets started, it will need to know the mapping of some hostnames to IP addresses before DNS can be referenced. This mapping is kept in the /etc/hosts file.

In the absence of a name server, any network program on your system consults this file to determine the IP address that corresponds to a host name.

For your second question try to restart the network manager after editing your /etc/hosts file by typing this in terminal sudo service network-manager restart

storm
  • 4,973