Linux - sudo echo permission denied
作者:互联网
scnzzh@ZUBT:~$ sudo echo -e 'devops\tALL=(ALL)\tNOPASSWD:\tALL' > /etc/sudoers.d/devops
bash: /etc/sudoers.d/devops: Permission denied
The redirection is done by the shell before sudo is even started. So either make sure the redirection happens in a shell with the right permissions
sudo bash -c 'echo "hello" > f.txt'
or use tee
echo "hello" | sudo tee f.txt # add -a for append (>>)
标签:permission,sudo,tee,echo,devops,tALL,txt 来源: https://www.cnblogs.com/zhangzhihui/p/13844837.html