Pseudo-terminal will notbe allocated because stdinisnotaterminal

# test.sh
sudo apt update
ssh root@server_ip "bash" < ./test.sh

报错sudo: no tty present and no askpass program specified

我把命令改成

ssh -t root@server_ip "bash" < ./test.sh

报错Pseudo-terminal will not be allocated because stdin is not a terminal.

我再把命令改成

ssh -tt root@server_ip "bash" < ./test.sh

不报错,也可以输入密码,但是密码是明文的,而且输入密码后没有反应

求解决。

阅读 5.4k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进