Use sudo to execute commands remotely, with caution!

Source: Internet
Author: User

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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.