Passwordless SSH login [closed]

2019-05-20 16:11发布

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 enter image description here

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

So, I try this on my mac pro

  1. Step 3: generate the key enter image description here

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

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

  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 enter image description here

  5. Step 7: Still need the password enter image description here

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 enter image description here

标签: macos ssh centos
2条回答
爷的心禁止访问
2楼-- · 2019-05-20 16:33

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.

查看更多
神经病院院长
3楼-- · 2019-05-20 16:44

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.

查看更多
登录 后发表回答