Passwordless SSH login [closed]

2019-05-20 16:06发布

问题:

I want to login my server without the password, I have succeeded on the server localhost, but I failed when I try to login from my mac pro.

First, I test on my server.

  1. Step 1: generate the Key

  2. Step 2: cat to the authorized_keys, and Try Passwordless SSH login localhost, there is no problem.

So, I try this on my mac pro

  1. Step 3: generate the key

  2. Step 4: copy the public key to my sever, and cat to the authorized_keys

  3. Step 5: try login to my sever on my mac pro, still need the password

  4. Step 6: I google the "Passwordless SSH login", and find on the SSH said that The file named authorized_keys should have permissions 600 & ~/.ssh directory should generally have permission 700. So I do the following step

  5. Step 7: Still need the password

Can someone help this problem? My mac is OS X 10.11, My server is CentOS 7.0 64bit


Update:

  1. The config is the authorized_keys

回答1:

You process seems fine, but for MAC you seem to be missing one key step;

sudo systemsetup -setremotelogin on

you need to configure MAC to accept remote logins through setremotelogin as above.



回答2:

I've found that RHEL 7 and SELinux were the root cause, even after tweaking every variable in the /etc/ssh/sshd_config and making more keys than a locksmith. Login as root, and run this:

    setsebool -P use_nfs_home_dirs 1

You still have to create a key, share it with the other host login. My issue was that we were using NFS based "home" directories, so SELinux wasn't allowing access without this explicit flag.

Let me know if your problem goes away.



标签: macos ssh centos