I have a chroot and I want the chroot to have its own .inputrc file when it starts, and then run a program.
I'm used to starting the chroot with chroot <PATH> <PROGRAM_TO_RUN> so I tried
chroot <PATH> bind -f <PATH_IN_CHROOT>/.inputrc && <PROGRAM_TO_RUN>
but then I get the error:
chroot: failed to run command ‘bind’: No such file or directory
After reading the readline manual I saw bind was a bash builtin. So I tried using builtin to run the command like so:
chroot <PATH> builtin bind -f <PATH_IN_CHROOT>/.inputrc && <PROGRAM_TO_RUN>
but got the same error:
chroot: failed to run command ‘builtin’: No such file or directory
I know running two programs together via && works for chroot because I tested with:
~# chroot <PATH> echo "yo" && echo "Hi"
yo
Hi
~#
I also know that the bind command and the builtin command work on their own inside the chroot:
~# chroot <PATH> bash
/# builtin -h
bash: builtin: -h: invalid option
builtin: usage: builtin [shell-builtin [arg ...]]
/# builtin bind -h
bash: bind: -h: invalid option
bind: usage: bind [-lpsvPSVX] [-m keymap] [-f filename] [-q name] [-u name] [-r keyseq] [-x keyseq:shell-command] [keyseq:readline-function or readline-command]
/# bind -h
bash: bind: -h: invalid option
bind: usage: bind [-lpsvPSVX] [-m keymap] [-f filename] [-q name] [-u name] [-r keyseq] [-x keyseq:shell-command] [keyseq:readline-function or readline-command]
How can I run the bind command inside the chroot command so I can set a custom .inputrc for the chroot?
INPUTRCenvironment variable to the path of your inputrc file inside the chroot:INPUTRC=/path/to/inputrc chroot <jail> bashINPUTRCvar, do I need the path to include the outside chroot part or is that path inside the chroot only?chroot <jail> bash --rcfile fileand put your commands insidefile(its path is inside the chroot). If you have/dev/and/procmounted inside the chroot you could also usebash --rcfile <(echo 'cmd1; cmd2; ...').