[ale] Using a namespace to manage a chroot.

Steve Litt slitt at troubleshooters.com
Tue May 11 04:59:31 EDT 2021


Chris Fowler via Ale said on Sun, 9 May 2021 20:47:50 +0000

>For years I've been running SSH via chroot inside Linux installs on my
>workstation regardless of the version of Ubuntu the workstation
>currently runs.  This allows me to upgrade my workstation, while still
>compiling code inside a CentOS distribution.
>
>At boot I'll do something like this to prepare each chroot.
>
>START_PORT=55;
>for ii in CentOS-5-1 CentOS5-2 LFS-7.7; do
>  for iii in dev dev/pts proc sys; do
>    TEMPLATE="/opt/devel/${ii}"
>     mount -o bind /${iii} ${TEMPLATE}/${ii}
>     sed -i 's#^Port 22.*$#Port '${START_PORT}'#g'
> ${TEMPLATE}/etc/ssh/sshd_config chroot ${TEMPLATE}/${ii}
> /etc/init.d/sshd start START_PORT=$(( ${START_PORT} + 1 ))
>  done
>done
>
>After boot,  My Ubuntu 18.04 workstation will be running 3 other
>distributions.  I'll use SSH to access them as a regular user.  Tmux
>automatically runs on first login, other logins will attach to that
>session.

This is cool as hell. I don't fully understand it, but I like it.
And it looks like it would be handy for other things besides chroot
installations. Would you be able to give an online presentation of this
at the next GoLUG online meeting, via Jitsi, at 7pm the first Wednesday
of June?

Thanks,

SteveT

Steve Litt 
Spring 2021 featured book: Troubleshooting Techniques of the Successful
Technologist http://www.troubleshooters.com/techniques


More information about the Ale mailing list