Samba
The Samba project provides tools for Linux/Windows interoperability.
Windows AD and SMB/CIFS fileserver for UNIX
Samba server with debootstrap and KVM
Samba
#!/bin/bash # Create the appliance and configure shellinabox. # Process edits variable SHELLINABOX_ARGS which # will be evaluated by the daemon at runtime. 0<<-'BASH' \ 3<&0 \ 7<<-'SED' \ 5<<-'INIT' \ 6<<-'LKVM' \ 8<<-'APPLIANCE' \ bash -ex bash -x <&8 # Pipe the lkvm run command into sed script # The command is executed with shellinabox bash -esx <&7 6 | sed -f - -i /etc/default/shellinabox # Create a new supermin appliance rm -rvf init appliance.d cat > init <&5 chmod +x init tar zcf supermin.d/init.tar.gz init supermin --verbose --build supermin.d -f ext2 -o appliance.d e2fsck -y appliance.d/root > /dev/null || true BASH # This example shows how variable is used # SHELLINABOX_ARGS="--service=/:shellinabox:shellinabox:HOME:bash" # eval start-stop-daemon --pid 1 --start --exec /bin/bash -- -c "echo $SHELLINABOX_ARGS" <&$1 \ sed 's/\\/\\\\\\\\\\\\\\\\/g'| xargs -0 printf 'bash\\\\ -c\\\\ \\\\\\\\\\\\"%q\\\\\\\\\\\\"'| xargs -0 printf "\$s_=.*_=\"--service=/:root:root:HOME:%s\"_"| sed 's/\\n/\\&/g' SED #!/bin/sh # lkvm init script hostname samba hostname > /etc/hostname cat > /etc/hostname <<-HOSTS 127.0.0.1 $(hostname) HOSTS # users and groups etc touch /etc/passwd /etc/group /etc/shadow groupadd --gid=0 root groupadd --gid=1 daemon groupadd adm groupadd tty useradd --gid=0 --uid=0 --home-dir=/root --shell=/bin/bash root useradd --gid=1 --uid=1 --home-dir=/usr/sbin daemon useradd nobody test -d /var/ftp || mkdir --mode=555 /var/ftp && useradd --home-dir=/var/ftp ftp # http://www.tldp.org/LDP/lfs/LFS-BOOK-6.1.1-HTML/chapter06/devices.html mknod -m 600 /dev/console c 5 1 mknod -m 666 /dev/null c 1 3 mknod -m 666 /dev/ptmx c 5 2 mknod -m 666 /dev/random c 1 8 mknod -m 666 /dev/tty c 5 0 mknod -m 666 /dev/urandom c 1 9 mknod -m 666 /dev/zero c 1 5 chmod 666 /dev/null /dev/zero chown root:tty /dev/console /dev/ptmx /dev/tty chown root:root /dev/null /dev/zero chown root:root /dev/random /dev/urandom mkdir -v /dev/pts mkdir -v /dev/shm mount -vt devpts -o gid=4,mode=620 none /dev/pts mount -vt tmpfs none /dev/shm mount -vt proc /proc /proc mount -vt sysfs /sys /sys # init haveged && sleep 2 busybox --install -s test -d /usr/lib/jvm/default-java && stow --dir=/usr/lib/jvm/default-java --target=/usr/bin bin echo /var/spool/cron/atjobs/.SEQ | while read SEQFILE do if [ ! -f $SEQFILE ]; then echo 0 > $SEQFILE chmod 600 $SEQFILE chown daemon:daemon $SEQFILE fi done ifconfig lo 127.0.0.1 ifconfig eth0 up udhcpc eth0 ln -sf /usr/share/zoneinfo/UTC /etc/localtime mkdir /mnt cp /usr/share/samba/smb.conf /etc/samba/smb.conf -av cat >> /etc/samba/smb.conf <<-'SMB' [share] comment = Some useful files read only = no path = /mnt guest ok = yes browsable = yes guest account = nobody guest only = yes admin users = nobody SMB # renew dhcp after login cat > /root/.profile <<-'RUNLEVEL' #!/bin/sh udhcpc eth0 RUNLEVEL # invoke-rc.d runlevel see runit-init cat > /sbin/runlevel <<-'RUNLEVEL' #!/bin/sh exec printf 'N 2' RUNLEVEL chmod +x /sbin/runlevel cat > /etc/modules <<-'MODULES' 9pnet_virtio MODULES cat > /etc/fstab <<-'FSTAB' hostfs /var/ftp/pub 9p trans=virtio 0 0 overlay /mnt overlay lowerdir=/var/ftp/pub,upperdir=/var/tmp/ftp/pub,workdir=/var/tmp/work hostfs /mnt 9p trans=virtio 0 0 overlay /var/ftp/pub overlay lowerdir=/mnt/pub,upperdir=/var/tmp/pub,workdir=/var/tmp/work FSTAB # https://busybox.net/FAQ.html#job_control cat > /etc/init.d/rcS <<-'RUN' DEBIAN_FRONTEND=noninteractive \ pam-auth-update --package --force invoke-rc.d --force vsftpd start invoke-rc.d --force nmbd start invoke-rc.d --force smbd start invoke-rc.d --force samba-ad-dc start # invoke-rc.d --force atd start # invoke-rc.d --force jenkins start RUN chmod +x /etc/init.d/rcS cat > /etc/inittab <<-'INITTAB' # /etc/inittab init(8) configuration for BusyBox # # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> # Boot-time system configuration/initialization script. # This is run first except when booting in single-user mode. ::sysinit:/etc/init.d/rcS # Note below that we prefix the shell commands with a "-" to indicate to the # shell that it is supposed to be a login shell. Normally this is handled by # login, but since we are bypassing login in this case, BusyBox lets you do # this yourself... # # Start an "askfirst" shell on the console (whatever that may be) #::askfirst:-/bin/sh ::respawn:-/sbin/sulogin --force --login-shell --timeout=100 # Example of how to put a getty on a serial line (for a terminal) #::respawn:/sbin/getty -L ttyS0 9600 vt100 # Stuff to do when restarting the init process ::restart:/sbin/init # Stuff to do before rebooting ::ctrlaltdel:/sbin/reboot ::shutdown:/bin/umount -a -r ::shutdown:/sbin/swapoff -a INITTAB #update-alternatives --install /usr/bin/wine wine /usr/bin/wine-stable 50 echo Welcome to supermin! exec busybox init INIT while true do lkvm run --9p /mnt,hostfs \ -n \ -k appliance.d/kernel \ -i appliance.d/initrd \ -d appliance.d/root \ -p 'root=/dev/vda' \ || break done LKVM #!/bin/sh apt install --yes supermin kvmtool shellinabox || exit 1 DEBIAN_FRONTEND=noninteractive apt install \ --quiet \ --assume-yes \ --option='Acquire::http::AllowRedirect=true' \ --option='APT::Get::Download-Only=false' \ at bash curl dash man mount base-files busybox strace ncurses-term ncurses-bin samba smbclient cifs-utils smbldap-tools ldap-utils udhcpc stow sysvinit-utils util-linux login rsync libc-bin libpam-runtime libpam0g apache2-utils vsftpd sed haveged ssh || exit 1 #wine wine32 winetricks # SUPERMIN_KERNEL=/boot/vmlinuz-4.9.0-12-686 \ supermin --host-cpu=i686 --verbose --prepare --use-installed -o supermin.d at busybox mount bash curl dash udhcpc strace samba file base-files bsdutils mailutils coreutils tzdata ncurses-bin ncurses-term eudev net-tools hostname elogind smbclient stow sysvinit-utils util-linux login rsync libc-bin libpam-runtime libpam0g apache2-utils vsftpd sed haveged ssh || exit 7 find /etc/init.d/{cron,exim4,haveged,elogind,smbd,nmbd,vsftpd,cron,apache2,atd} -type f | xargs -I@ sh @ stop APPLIANCE