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

error log: -bash: /home/someone/.bash_history: Permission denied

devnull
  • 118,548
  • 33
  • 236
  • 227
ponypaver
  • 397
  • 1
  • 2
  • 14

1 Answers1

1

Your not running the whole command with sudo. try

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

The part after the redirect isnt running as root

For more examples

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

Community
  • 1
  • 1
exussum
  • 18,275
  • 8
  • 32
  • 65