Solution to prompt insufficient permissions for linux echo commands, and insufficient echo Permissions

Source: Internet
Author: User
Tags echo command

Solution to prompt insufficient permissions for linux echo commands, and insufficient echo Permissions

This article is reproduced here: http://blog.csdn.net/u010780613/article/details/51491237

Problem description:

When using the Ubuntu system, I encountered a problem: I used a common user to log on to the system, and then executed sudo echo "This is testPage. "> when running the/usr/local/nginx/html/index.html command, the system prompts that the permission is insufficient.

Although I know that the echo command belongs to the root user, I have always thought that adding a sudo command will be able to get all the permissions of the root user, and now I find that this is not correct. After using the sudo command, only some root permissions are obtained.

 

Solution:

1. directly use the root user, so there will certainly be no problem;

2. The specific implementation is as follows:

Sudo sh-c 'echo "This is testPage.">/usr/local/nginx/html/index.html'

** Note that single quotation marks must be added to the entire echo command.

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.