Reputation: 473
n00b question.
I have to issue a terminal command that will enter a chroot, issue a command (such as "ls"), and then stay in chroot so the user can type more commands.
Right now this is the best I've got:
cat << EOF | sudo chroot /path/to/chroot
ls
EOF
Unfortunately this exits the chroot as soon as it is finished though.
How can I stay in the chroot?
Upvotes: 1
Views: 1325
Reputation: 312213
You could do something like this:
sudo chroot /path/to/chroot sh -c "ls; bash"
This will run ls
and then start an interactive bash
shell.
Upvotes: 3