Showing results for 
Search instead for 
Did you mean: 

ssh passwordless login

Occasional Contributor

ssh passwordless login




I am successful in generating ssh keys for some servers and I am able to login without password.


but for some servers,i am getting the below error message


ssh wiz001


ssh: Could not resolve hostname wiz001: host nor service provided, or not known


what could be the problem.How can I solve it.





Patrick Wallek
Honored Contributor

Re: ssh passwordless login

Can you do something like:


# nslookup wiz001




# nsquery wiz001


And does it return the hosts IP address.  If it does not, then that host is either not in DNS or not in the /etc/hosts file of your server.

Occasional Contributor

Re: ssh passwordless login



I checked with nslookup and it does not return any output.



but I tried to create a hosts file in my home directory adding ipaddress and hosts name


cat hosts


wiz001 ipaddress



but eventhough its not working.



Honored Contributor

Re: ssh passwordless login

> I checked with nslookup and it does not return any output


Did you actually type the "#" sign in Patrick's suggestion? It was supposed to be the command prompt of the root user, suggesting that you should run the nslookup command as root.


When you type the "#" sign, it means that the shell should completely ignore the line past the "#" sign. It is used in shell scripts to write descriptive comments.


When properly used, the nslookup command should always produce some output.


> ...I tried to create a hosts file in my home directory...


Why would the system look for a hosts file in your home directory? The only standard location for a hosts file is /etc/hosts. As far as I know, there is no way to tell HP-UX to read a hosts file from a non-default location.


And your syntax is wrong for a hosts file: the IP address must be first, then the primary hostname, then alias names (if there are any).


If you are not allowed to write to /etc/hosts, you can use the SSH configuration file for the same purpose.

There should be a directory named .ssh in your home directory. Create a file named "config" in it. It should have two lines in it:

Host wiz001
        HostName ipaddress


This tells the ssh command (only the ssh command and its friends scp and sftp, and only on your user account) that when you type "ssh wiz001", you actually mean "ssh ipaddress".


If you often have to use long and complex hostnames or IP addresses with ssh commands, this can be an useful way to create short names that are easier to type.

Chirag Parikh
Frequent Advisor

Re: ssh passwordless login

Please update the hostname and IP address entry into system host file /etc/hosts to resolve the issue.

OR you may do ssh to IP address instead of hostname.

Chirag Parikh.
Occasional Advisor

Re: ssh passwordless login

A better solution would be to ask your DNS administrator to set up the appropriate entries in the DNS.