Execute command in jail

1.3k Views Asked by At

I'm using Jailkit. Is it possible to execute a command inside the jail and get the output (from outside) ? I did a lot of digging in the docs but unable to find anything.

2

There are 2 best solutions below

0
On

If you want to write the output of your jailed command in a non jailed subdirectory you may use the mount command with the option --bind. For example if you want your jailed command to write a file in the non-jailed subdirectory /var/xxx, you should do:

mkdir /jail/home/myuser/jailed
mount --bind /var/xxx /jail/home/myuser/jailed

Of course, the subdirectory /var/xxx must have write permissions for the user.

3
On

If you wanted to put an impact outside chroot jail, by executing command inside chroot jail, that's not possible.