2

I'm using the dancers shell to try and run install commands on multiple machines on the network, but whenever I do I get

no tty present and no askpass program specified.

I know that if I use ssh -t for the command, I can avoid this, but is there a way to dsh or ssh to run a command on multiple machines without using the -t command?

Command I'm running:

`dsh -aM -c sudo apt-get install python`
0

sudo by default will read the password from the attached terminal. Your problem is that there is no terminal attached when it is run from the console.

1 open /etc/sudoers

type sudo vi /etc/sudoers. This will open your file in edit mode.

2 Add/Modify linux user

Look for the entry for Linux user. Modify as below if found or add a new line.

<USERNAME> ALL=(ALL) NOPASSWD: ALL

3 Save and Exit from edit mode

-2

You can avoid sudo requiring TTY by adding this option Defaults !requiretty in /etc/sudoers file. But if sudo still requires password, than it will not help you, unless you set NOPASSWD to your user. Basically the changes you want can look somehow like this:

Defaults:your_user !requiretty
your_user ALL = NOPASSWD: ALL

Preferred way of editing this file is using visudo, which will check syntax before writing the file back to the disk.

2
  • I'm assuming you mean adding that to the visudo, but would I do that for the machine I'm running the command from or do I need to edit the sudo of every machine I'm trying to connect to?
    – MCSTS
    Sep 11 '15 at 19:06
  • yes. Using visudo is preferred way. You would need to set it up on the remote machines, but if you tested the file, you can just copy it to its place in /etc/sudoers. Sorry, I probably missed the file and tool in the answer. Fixing now.
    – Jakuje
    Sep 11 '15 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.