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 (>>)
上一篇:花椒Android客户端多变体构建实践,android常见面试题


下一篇:【Android】生成包名称