Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试运行具有以下内容的 bash 脚本:
ssh -l <username> <compname> 'sudo yum -y install expect'
我得到错误:
sudo: sorry, you must have a tty to run sudo
在某些计算机上,但在其他计算机上,该过程运行顺利。我怎样才能防止这种情况?
使用该-t标志强制分配一个 tty:
-t
ssh -t -l <username> <compname> 'sudo yum -y install expect'