I‘m trying to run the following command:
But, an error is displayed follows:
How do I fix this problem on Linux or Unix based systems? This is done in Fedora, RHEL, CentOS, many other Linux distribution, and Unix-like systems for security concern as it will show the password in clear text format
What is the fix on a Linux or Unix bash shell?
You have to run your ssh command as follows to avoid this error:
The -t option force pseudo-tty allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g., when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.
The requiretty option in sudoers file
The requiretty if set in sudo config file sudoers, 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, shell/perl/python or cgi-bin scripts. This flag is set on many distores by default. Edit /etc/sudoers, file, enter:
Find line that read as follows:
Either comment it out the line or delete the line:
Save and close the file.
How Do I run command without using the -t option?
You can use the su command instead of the sudo command as follows:
You can run /scripts/job5143 as vivek user using the same syntax:
Another option is to use the following syntax (see below in comments):
See man pages for more info – ssh(1),sudoers(5),visudo(8)