ssh username@server 'sudo command'

gives “standard in must be a tty”. First solution: Edit your /etc/sudoers file, by using visudo command:


comment out the line “Defaults requiretty”.

A most secure way should be to add:</p>

Defaults:[username] !requiretty

Second solution: forcing allocation of a pseudo-tty.by using -t option

ssh -t username@server 'sudo command'

Additional information

This behaviour is not the default. Only Redhat distributions of sudo that had requiretty in its default sudoers. It will be fixed in newer releases