我希望锁定我们的 Solaris 10、RHEL 5 和 SLES 11.2 服务器。我注意到有些用户没有 SSH 密钥的密码。有没有办法用脚本检查这个?
下面我发布了我根据@tylerl 给我的答案写的脚本。我发布此信息以防其他人将来需要此信息。很可能有更好的方法来做到这一点,但这是有效的。我仍然需要为未自动挂载的帐户编写其他脚本。感谢大家的帮助
#!/bin/bash
# This script is for checking for a blank passphrase. Meaning no passphrase to secure your SSH key.
# Script most be run as root.
# Example: sudo ./check-sshkeys
mount share:/vol/home /mnt
ls /mnt >/tmp/ls
for s in `cat /tmp/ls`
do echo -e "\e[1m User $s \033[0m "
if ls /mnt/$s/.ssh/id_rsa 2>/dev/null
then grep ENCRYPTED /mnt/$s/.ssh/id_rsa || echo -e "No RSA
passphrase"
else echo "RSA key …Run Code Online (Sandbox Code Playgroud)