开发者

How to sudo on a computer using ssh inside a bash script

I'm trying to run a bash script that has:

ssh -l <username> <compname> 'sudo yu开发者_StackOverflowm -y install expect'

I get the error:

sudo: sorry, you must have a tty to run sudo

on some computers but on others the process runs smooth. How can I prevent this?


Use the -t flag to force a tty to be allocated:

ssh -t -l <username> <compname> 'sudo yum -y install expect'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜