Ssh-keygen troubleshooting

Source: Internet
Author: User
Ssh-keygen troubleshooting-Linux Enterprise Application-Linux server application information. The following is a detailed description. The ssh key logon method is not used for a period of time. If you want to use the key method on two servers, you do not have to enter the password for each login. It takes a long time to get in trouble.

Server1: RHEL4U4

[Nianzong @ apache. ssh] $ uname-
Linux apache 2.6.9-42. ELsmp #1 SMP Wed Jul 12 23:27:17 EDT 2006 i686 i686 i386 GNU/Linux

Server2: This is CentOS4.6

[Nianzong @ mail. ssh] $ uname-
Linux mail 2.6.9-67. ELsmp #1 SMP Fri Nov 16 12:48:03 EST 2007 i686 i686 i386 GNU/Linux

In the past, ssh key logon was performed using the root account, which is basically always unfavorable. You can use the default permission. In today's experiment, both machine accounts are nianzong, a common account. Follow these steps:

1. ssh-keygen-t rsa; press ENTER
2. Send the generated public key id_rsa.pub scp to the Remote server.
3. cat id_rsa.pub> authorized_keys

In the end, a password is prompted during ssh logon. I suspect that ssh configuration and firewall are preferred. After debugging, the password still does not work. Then, use the root account to redo it again. Everything is OK. It seems that it has nothing to do with those things.

Ssh-v doesn't know anything. tail-f/var/log/secure can see the following log:

Jul 31 07:45:22 mail sshd [668]: Failed gssapi-with-mic for nianzong from: ffff: 192.168.1.184 port 38315 ssh2
Jul 31 07:45:22 mail sshd [668]: Failed gssapi-with-mic for nianzong from: ffff: 192.168.1.184 port 38315 ssh2
Jul 31 15:45:22 mail sshd [667]: Authentication refused: bad ownership or modes for file/home/nianzong/. ssh/authorized_keys
Jul 31 07:45:22 mail sshd [668]: Failed publickey for nianzong from: ffff: 192.168.1.184 port 38315 ssh2

Google and baidu have no valuable articles. After carefully reading the keyword "bad ownership", ls-lh checks that the owners and groups on both sides are nianzong, so there should be no mistakes. Check that the authorized_keys permission for the experiment with root is 600, while the current nianzong permission is 644. It will be OK after it is changed to 600. Although the key is successfully used to log on, however, I read the following logs:

Jul 31 08:50:24 mail sshd [19330]: Failed gssapi-with-mic for nianzong from: ffff: 192.168.1.184 port 38335 ssh2
Jul 31 08:50:24 mail sshd [19330]: Failed gssapi-with-mic for nianzong from: ffff: 192.168.1.184 port 38335 ssh2
Jul 31 08:50:24 mail sshd [19330]: Postponed publickey for nianzong from: ffff: 192.168.1.184 port 38335 ssh2
Jul 31 16:50:24 mail sshd [19329]: Accepted publickey for nianzong from: ffff: 192.168.1.184 port 38335 ssh2
Jul 31 08:50:24 mail sshd [19330]: Accepted publickey for nianzong from: ffff: 192.168.1.184 port 38335 ssh2

For the Failed gssapi-with-mic in the log, the root account is logged on as well. This error is still unknown and can only be found later.

OK, throubleshooting ends here.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.