9

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

ssh -l <username> <compname> 'sudo yum -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?

2
  • superuser.com might be a better place for this question Commented Oct 31, 2009 at 10:21
  • The question is programming related because it is in a script. That is enough to make it valid for SO. No mere user would need to know this. Commented Oct 31, 2009 at 10:25

1 Answer 1

22

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

ssh -t -l <username> <compname> 'sudo yum -y install expect'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.