当我运行fabric.operations.sudo从远程VM(其内核是4.14.35 EL7.6)获取信息时,例如“date +%s”,例外结果应为“1549853543”,但在我的测试,这是“上次登录:星期二2月11日02:53:18 UTC 2019年pts / 0 \ r \ n \ n1549853543”。
我运行了命令“ssh user @ vm'date +%s'”,结果是正常的(只有数字)。
有谁知道是什么原因?我还在/ etc / ssh / sshd_config中将“PrintLastLog”修复为“no”。
result = sudo('date +%s').stdout.strip()
run_time = int(result) => exception occurs
除外:1549853543
实际:int()的基数为10的无效文字:'上次登录:星期一2月11日02:53:18 UTC 2019年pts / 0 \ r \ n \ n1549853543'
修复2个地方似乎最后一次登录信息消失:
2:/ etc / ssh / sshd_config:
# Per CCE-CCE-80225-6: Set PrintLastLog yes in /etc/ssh/sshd_config
PrintLastLog no