系统:centos6.5
openssl版本:6.9p1
/etc/ssh/sshd_config配置文件做以下修改:
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysCommand /usr/bin/ldap_ssh_key.sh
AuthorizedKeysCommandUser nobody
然后赋予 /usr/bin/ldap_ssh_key.sh 文件 755 的权限。
ldap_ssh_key.sh脚本代码:
#!/bin/bash
if [ "$1" == "wangqilong" ]; then
echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAveKaks3F9A+DdN7G3+cHvZU/s4cvXbTS/Pm3BNzS4NTtijRJFp69131XabF0Bokm/sR9+Nvtrmlf5/QTFXpcvPCuzg/DCgOGR3EX7kRP7BrYSKGCnlC3DLpxDJaSPA39nDSujfdPTVl+IhdSctxegf95mfC/HIXdCrdOgiijAH7Osy8V1ljUEMeRnWVLq0G9twWUEi93ncSJjzKRLnAO8YlMQk/yLrVPkeHBFuxA04d/9PAN8qcrA4dz2uAJXPSaz1E1iCn0tgRAtWjPzHJCKlJcJZQ4h5ku03IPwReWX2Hcuxf3DaEH9+9xnMwU7DVtHGMMqolxW5rP2kFD5KVclQ=="
fi
些脚本主要是输入用户的公钥key的内容。
本文出自 “smile_青春” 博客,请务必保留此出处http://smileyouth.blog.51cto.com/7273768/1749167
原文地址:http://smileyouth.blog.51cto.com/7273768/1749167