我必须运行一个命令来自动杀死某些进程:
echo 123456|ps auxf|grep serving/main |grep -v grep|awk '{print $2}'|sort -r|sudo -S xargs kill -2
如果我直接在服务器A中运行,它就可以运行。
但如果我像这样在服务器B中运行:
ssh test@172.17.0.6 "echo 123456|ps auxf|grep serving/main |grep -v grep|awk '{print $2}'|sort -r|sudo -S xargs kill -2"
哪个ssh到服务器A并运行第一个命令,它总是说密码错误:
[sudo] password for test:
Sorry, try again.
[sudo] password for test:
Sorry, try again.
[sudo] password for test:
Sorry, try again.
sudo: 3 incorrect password attempts
我输入了ssh的密码。错误在sudo中有效。我该如何解决? THX。