lxc-sshd.in revision c01d62f21b21ba6c2b8b78ab3c2b37cc8f8fd265
883N/A# lxc: linux Container library 883N/A# Daniel Lezcano <daniel.lezcano@free.fr> 883N/A# This library is free software; you can redistribute it and/or 883N/A# modify it under the terms of the GNU Lesser General Public 883N/A# License as published by the Free Software Foundation; either 883N/A# version 2.1 of the License, or (at your option) any later version. 883N/A# This library is distributed in the hope that it will be useful, 883N/A# but WITHOUT ANY WARRANTY; without even the implied warranty of 883N/A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 883N/A# Lesser General Public License for more details. 883N/A# You should have received a copy of the GNU Lesser General Public 883N/A# License along with this library; if not, write to the Free Software 883N/A# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 883N/Aroot:x:0:0:root:/root:/bin/bash 883N/Asshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin 883N/A # by default setup root password with no password 883N/A cat <<EOF > $rootfs/etc/ssh/sshd_config HostKey /etc/ssh/ssh_host_rsa_key HostKey /etc/ssh/ssh_host_dsa_key UsePrivilegeSeparation yes KeyRegenerationInterval 3600 RhostsRSAAuthentication no HostbasedAuthentication no ChallengeResponseAuthentication no cat <<EOF >> $path/config lxc.mount.entry=/dev $rootfs/dev none ro,bind 0 0 lxc.mount.entry=/lib $rootfs/lib none ro,bind 0 0 lxc.mount.entry=/bin $rootfs/bin none ro,bind 0 0 lxc.mount.entry=/usr /$rootfs/usr none ro,bind 0 0 lxc.mount.entry=/sbin $rootfs/sbin none ro,bind 0 0 lxc.mount.entry=tmpfs $rootfs/var/run tmpfs defaults 0 0 lxc.mount.entry=@BINDIR@/lxc-sshd $rootfs/sbin/init none bind 0 0 if [ "$(uname -m)" = "x86_64" ]; then cat <<EOF >> $path/config lxc.mount.entry=/lib64 $rootfs/lib64 none ro,bind 0 0 $1 -h|--help -p|--path=<path> if [
"$(id -u)" !=
"0" ];
then echo "This script should be run as 'root'" echo "'lxc-init is not accessible on the system" echo "'sshd' is not accessible on the system " echo "'path' parameter is required" echo "failed to install sshd's rootfs" echo "failed to configure sshd template" echo "failed to write configuration file"