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.