关闭

sudo redirect

标签: linuxsudo
754人阅读 评论(0) 收藏 举报
分类:


Permission denied when redirection with sudo

Answer:

When you are doing redirection with sudo, such as the following command

# sudo echo 1 > /proc/sys/vm/drop_caches

-bash: /proc/sys/vm/drop_caches: Permission denied

You will get permission denied as the redirection will be performed as the user calling sudo, not as the superuser. So if you don't have permission to write to the target file, you will get permission denied.

To solve the problem, use the following method

sudo sh -c 'echo 1 > /proc/sys/vm/drop_caches'


what's wrong ?

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:127966次
    • 积分:2487
    • 等级:
    • 排名:第14843名
    • 原创:118篇
    • 转载:22篇
    • 译文:3篇
    • 评论:65条
    最新评论