Closed. This question is off-topic. It is not currently accepting answers. Learn more
想改进这个问题吗?Update the question所以堆栈溢出的值小于aa>。
6年前关闭。
sudo chroot /tmp/jail /bin/echo 'test' > /home/someone/.bash_history

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

最佳答案

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

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

重定向后的部分不是以根用户身份运行的
更多的例子
How do I use sudo to redirect output to a location I don't have permission to write to?

关于linux - 使用chroot运行命令时,权限被拒绝,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16333435/

10-12 21:24