Recently, in the company's own publishing system has encountered a problem, the release system one of the functions is to remotely perform a database backup function, is to remotely execute a backup script on the server. The backup script checks to see if the backup directory exists and, if it does not, creates a backup directory. Because the remote user is non-rooted, sudo is added when the directory is created. The following error occurred while performing a remote backup through the publishing system:
5sudo:no TTY present and no Askpass program specified
Google on the web, you need to modify the sudo configuration file. Workaround:
1. Note Defaults Requiretty
Defaults Requiretty modified to #Defaults Requiretty, indicating that no control terminal is required.
Otherwise there will be sudo:sorry, you must has a TTY to run sudo
2. Add line Defaults VISIBLEPW
Otherwise there will be sudo:no tty present and no Askpass program specified
I found that Sudo-1.6.9p17-5.el5 is not supported by this parameter, SUDO-1.7.2P1-10.EL5 support.
The first question has come across. The second one I haven't tried.
But I think if you can avoid, try not to remotely execute the sudo command, too troublesome, but also change the configuration file, but also adapt to the environment.
It is better to use the Curve method, first build the directory, without the remote sudo. So be cautious with remote sudo
This article is from "Constant line Mowgli's blog" blog, please be sure to keep this source http://liheng2011.blog.51cto.com/3091246/1639381
Use sudo to execute commands remotely, with caution!