试试Linux的script命令来记录用户操作的命令: 将下面命令添加的用户环境变量中:~/.bash_profile /usr/bin/script -qafc "sshpass -p ssh root@192.168.1.1" /log/a.log