sudo error is invoked in the script, causing the device not to mount correctly

Source: Internet
Author: User

If the command is invoked using the sudo command in the script, a Sudo:sorry is reported, and you must the error of the a TTY to run sudo

For example, writing in a script

sudo mount/dev/sdc/app/backup

Will error Sudo:sorry, you must has a TTY to run sudo, causing the device to not mount correctly

If you must use the sudo command in your script, you need to modify the configuration file/etc/sudoers

Comment out the Default requiretty line

#Default Requiretty

# Disable "ssh hostname sudo <cmd>", because it'll show the password in clear.

# You has to run "ssh-t hostname sudo <cmd>".

#

#Defaults Requiretty

However, when this option is blocked, the sudo command can be executed remotely via SSH, and there is a certain risk

Depends on the environmental requirements and whether it is necessary.

This article is from the "Database Road" blog, make sure to keep this source http://dbaway.blog.51cto.com/7099215/1683939

sudo error is invoked in the script, causing the device not to mount correctly

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.