Great. Look at the home and .ssh directories permissions (and acl's if any ) on the account that works - both local and remote. Make the one that fails match permissions exactly to the good account. Do that for key files as well. Keyfiles have to match ownership with the owner of the home directory.
This is the most common way to get and fix the result you see. There are lots of other ways things can get broken, but this will get you started. Next step is setting correct key files with correct permissions on key files in the .ssh directory for the bad account. Both servers. Remember, to login from a remote node the place that gets logged into has to have the correct keys from the incoming site in the user's .ssh directory.
See if that will get you going. If not, check back here.
I compared all the permission with home and ssh directory all are same. I tried to do on a different server . I got below error. Not sure why on the other machine I am getting connection refused. It should show ask for password atleast.
On the remote box:
is there an entry in sshd_config: UsePAM yes If so,
Then is there an entry for the user that cannot connect? in /etc/security/access.conf
This typically disables local logins but with ssh it will disable network as well, I believe.
It looks like net login is disabled for that particular user. I do not know how that would have been setup based on what you said so far.
When you are already logged into the remote box with an account that works, can you use either su - baduser or do a console connect and login (not a network login)?
The user may not even be able to login locally.
I just looked and find when I type users in the remote machine I am not able to find the one user I am looking . will that be a reason ?. However I am able to sudo to the user
---------- Post updated at 07:38 AM ---------- Previous update was at 12:38 AM ----------
Other things noted:
When I changed the authorized_keys to chmod 777 the ssh prompted me to enter the password. When I make it as chmod 700 ssh showed below error