Connection-less using ssh

Hi!

I know its a recurring problem, but I am failing to sort this out, I have two servers ( A and B), in which I am able to connect without having to put password from server B to server A, but the connect from server A to server B.
takes 7 minutes to establish???
on Server A, I have the following settings:

 ls -ld
drwxr-xr-x   8 nikira   sys       128512 Mar 24 03:45 .
[nikira@nikira-app1 nikira_data01]$ cd .ssh/
[nikira@nikira-app1 .ssh]$ ls -lrt
total 16
-rw-------   1 nikira   sys          672 Aug  2  2012 id_dsa
-rw-r--r--   1 nikira   sys          608 Aug  2  2012 id_dsa.pub
-rw-------   1 nikira   sys          883 Aug  2  2012 id_rsa
-rw-r--r--   1 nikira   sys          228 Aug  2  2012 id_rsa.pub
-rw-------   1 nikira   sys          834 Aug  2  2012 authorized_keys
-rw-r--r--   1 nikira   sys         2385 May 28  2013 known_hosts
[nikira@nikira-app1 .ssh]$ pwd
/nikira_data01/.ssh
[nikira@nikira-app1 .ssh]$

And on server B:

 cd /nikira_data01
[nikira@nikira-app2 nikira_data01]$ ls -ld
drwxr-xr-x   6 nikira   sys          512 Aug 28  2012 .
[nikira@nikira-app2 nikira_data01]$ cd .ssh/
[nikira@nikira-app2 .ssh]$ ls -lrt
total 16
-rw-------   1 nikira   sys          668 Aug  2  2012 id_dsa
-rw-r--r--   1 nikira   sys          606 Aug  2  2012 id_dsa.pub
-rw-------   1 nikira   sys          887 Aug  2  2012 id_rsa
-rw-r--r--   1 nikira   sys          228 Aug  2  2012 id_rsa.pub
-rw-------   1 nikira   sys          606 Aug  2  2012 authorized_keys_bkp
-rw-------   1 nikira   sys          834 Aug  2  2012 authorized_keys
-rw-r--r--   1 nikira   sys         1769 Oct  2  2013 known_hosts
[nikira@nikira-app2 .ssh]$ pwd
/nikira_data01/.ssh
[nikira@nikira-app2 .ssh]$

So I have exactly the same settings, but its taking almost 10 minutes to connect from A to B, but almost instantly from B to A
Please can you help?

Problems like this instantly make me think of DNS problems, although 7+ minutes is very long. Did you check/compare your DNS configuration?

I have looked at

/etc/nsswitch.conf

, so in server A, this file is lile this:

passwd:     files
group:      files
#hosts:      dns files
hosts:      files

and on server B the same file looks like this:

passwd:     files
group:      files
#hosts:      files dns
hosts:      files
ipnodes:    files

But what is strange, is from server A to a third server (server C) it does not ask for a password and its fast in both directions.

The issue is only between one direction between server A and server B

Do the servers have their own names listed in /etc/hosts ?

yes, I have FQDN in

/etc/hosts

, but for some unknow reason, because I did not do anything, its now OK???? I have only try to ssh using IP address rather hostname, so it was quick

Because you don't use a name service like DNS, any hostname must be in /etc/hosts.
What OS?

uname -sr

In case of Solaris check /etc/inet/ipnodes in addition to /etc/inet/hosts and its link /etc/hosts.

Hi

 uname -sr
SunOS 5.10

the contents of the 3 files you mention are the same in all 3 servers, but as said previously, for some reason it looks fine now, as it takes only 3 secs to login:

 time ssh nikira-app2
Last login: Wed Mar 25 08:40:52 2015 from 10.100.4.72
Oracle Corporation      SunOS 5.10      Generic Patch   January 2005
[nikira@nikira-app2 ~]$ exit
logout
Connection to nikira-app2 closed.

real    0m3.711s
user    0m0.318s
sys     0m0.047s
[nikira@nikira-app1 ~]$

File system quota checks on NFS file systems. Look in /etc/profile, IIRC.

Usually doing something like "touch ~/.hushlogin" will prevent that.

The slow server probably had unreachable NFS servers - each file system on such servers needed to be checked for quotas and the check had to time out. It works now because the NFS servers are up.