运行环境Centos6.4
1. openssh6.1 以上版本支持 AuthorizedKeysCommand 。如果使用的是redhat系列发行版本,openssh5.x已经被patch 并且支持 AuthorizedKeysCommand。
确保目录覆盖系统上自带的sshd
./configure --prefix=/usr
2. centos默认的/etc/ssh/sshd_config 文件下增加两个设置
AuthorizedKeysCommand /bin/echo (这个Command程序要放在系统环境目录下,建议 /usr/libexec/openssh/ssh_command)
AuthorizedKeysCommandUser nobody
注意1:RED HAT patch的openssh5.x 版本使用的是 AuthorizedKeysCommandRunAs
注意2:如果不能加载config,请在 /etc/init.d/sshd 启动脚本里添加 -f /etc/ssh/sshd_config 开关
参考文章:
http://serverfault.com/questions/162238/openssh-with-public-keys-from-database