sudo – 在Ubuntu中可以root覆盖任何文件吗?

前端之家收集整理的这篇文章主要介绍了sudo – 在Ubuntu中可以root覆盖任何文件吗?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在Ubuntu 10.04.02上.我认为在使用以root身份执行命令的sudo时.但在这里作为root我无法写入我自己的文件.它是否正确?
david@ubuntu:/var/www/system/paydaydebt/log$ls -l
total 16
-rw-r--r-- 1 root root   32 2011-08-27 01:00 cron_daily.log
-rw-r--r-- 1 root root 5082 2011-08-27 20:45 cron_email.log
-rw-r--r-- 1 root root  429 2011-08-27 20:00 cron_hourly.log
david@ubuntu:/var/www/system/paydaydebt/log$sudo date >> cron_email.log
-bash: cron_email.log: Permission denied

david@ubuntu:/var/www/system/paydaydebt/log$sudo chmod 664 cron_email.log
david@ubuntu:/var/www/system/paydaydebt/log$ls -l
total 16
-rw-r--r-- 1 root root   32 2011-08-27 01:00 cron_daily.log
-rw-rw-r-- 1 root root 5082 2011-08-27 20:45 cron_email.log
-rw-r--r-- 1 root root  429 2011-08-27 20:00 cron_hourly.log
david@ubuntu:/var/www/system/paydaydebt/log$sudo date >> cron_email.log
-bash: cron_email.log: Permission denied

david@ubuntu:/var/www/system/paydaydebt/log$sudo chmod 666 cron_email.log
david@ubuntu:/var/www/system/paydaydebt/log$ls -l
total 16
-rw-r--r-- 1 root root   32 2011-08-27 01:00 cron_daily.log
-rw-rw-rw- 1 root root 5082 2011-08-27 20:45 cron_email.log
-rw-r--r-- 1 root root  429 2011-08-27 20:00 cron_hourly.log
david@ubuntu:/var/www/system/paydaydebt/log$sudo date >> cron_email.log

david@ubuntu:/var/www/system/paydaydebt/log$sudo chmod 644 cron_email.log
david@ubuntu:/var/www/system/paydaydebt/log$ls -l
total 16
-rw-r--r-- 1 root root   32 2011-08-27 01:00 cron_daily.log
-rw-r--r-- 1 root root 5111 2011-08-27 20:47 cron_email.log
-rw-r--r-- 1 root root  429 2011-08-27 20:00 cron_hourly.log
david@ubuntu:/var/www/system/paydaydebt/log$sudo date >> cron_email.log
-bash: cron_email.log: Permission denied
david@ubuntu:/var/www/system/paydaydebt/log$
sudo仅适用于命令运行;你的追加>>以当前用户身份发生.
原文链接:https://www.f2er.com/ubuntu/348199.html

猜你在找的Ubuntu相关文章