当chroot运行命令时,我得到了权限被拒绝

时间:2013-05-02 08:23:59

标签: linux bash sudo

sudo chroot /tmp/jail /bin/echo 'test' > /home/someone/.bash_history

错误日志:     -bash:/home/someone/.bash_history:权限被拒绝

1 个答案:

答案 0 :(得分:1)

你没有用sudo运行整个命令。尝试

sudo sh -c "chroot /tmp/jail /bin/echo 'test' > /home/someone/.bash_history"

重定向后的部分不是以root身份运行

更多示例

How do I use sudo to redirect output to a location I don't have permission to write to?