Linux and Unix tty to run sudo if I can sudo without a password over ssh

Fig.01: Linux and Unix tty to run sudo if I can sudo without a password over ssh

Fig.01: Linux and Unix tty to run sudo if I can sudo without a password over ssh

sudo require a TTY as configured in /etc/sudoers file:

Defaults requiretty

If set above options in config file, sudo will only run when the user is logged in to a real tty. When this flag is set, sudo can only be run from a login session and not via other means such as cron(8) or cgi-bin scripts. This flag is off by default. Or use ssh command as follows:

ssh -tt nixcraft@server1.cyberciti.biz 'stty raw -echo; sudo command-name-here.' < <(cat)

OR

ssh -t vivek@server1.cyberciti.biz command-name-here arg1 arg2

Examples and usage: sudo: Sorry, you must have a tty to run sudo Error on a Linux and Unix