Read-Only Root

Last modified by Leon Poon on 2019/11/02 17:29

find /tmplate -print0 | xargs -0 ls -ld

drwxr-xr-x 4 root root  4096 Jan  1  1970 /tmplate
drwxr-xr-x 2 root root  4096 Jan  1  1970 /tmplate/etc
-rw-r--r-- 1 root root   109 Dec 28  2015 /tmplate/etc/resolv.conf
drwxr-xr-x 6 root root  4096 Jan  1  1970 /tmplate/var
drwxr-xr-x 3 root root  4096 Jan  1  1970 /tmplate/var/cache
drwxr-xr-x 3 root root  4096 Jan  1  1970 /tmplate/var/cache/apt
drwxr-xr-x 3 root root 20480 Jan  1  1970 /tmplate/var/cache/apt/archives
-rw-r----- 1 root root     0 Nov  2 05:32 /tmplate/var/cache/apt/archives/lock
drwx------ 2 _apt root  4096 Jan  1  1970 /tmplate/var/cache/apt/archives/partial
drwxr-xr-x 3 root root  4096 Jan  1  1970 /tmplate/var/lib
drwxr-xr-x 2 root root  4096 Mar  3  2018 /tmplate/var/lib/dhcp
drwxr-xr-x 5 root root  4096 Jan  1  1970 /tmplate/var/log
drwxr-xr-x 2 root root  4096 Jan  1  1970 /tmplate/var/log/apt
-rw-rw---- 1 root utmp     0 Jan  1  1970 /tmplate/var/log/btmp
-rw-r----- 1 root adm      0 Jan  1  1970 /tmplate/var/log/dmesg
drwxr-xr-x 2 root root  4096 Jan  1  1970 /tmplate/var/log/fsck
-rw-r----- 1 root adm      0 Jan  1  1970 /tmplate/var/log/fsck/checkfs
-rw-r----- 1 root adm      0 Jan  1  1970 /tmplate/var/log/fsck/checkroot
drwxr-xr-x 2 ntp  ntp   4096 Jan  1  1970 /tmplate/var/log/ntpstats
-rw-rw-r-- 1 root utmp     0 Jan  1  1970 /tmplate/var/log/wtmp
drwxrwxrwt 2 root root  4096 Sep  8 10:51 /tmplate/var/tmp

mountall.sh:

mount tmpfs /tmp -t tmpfs -o nosuid && mkdir -pv /tmp/upper /tmp/working && mount tmpfs /tmp -t overlay -o lowerdir=/tmplate,upperdir=/tmp/upper,workdir=/tmp/working

find /var -type l -print0 | xargs -0 ls -ld

lrwxrwxrwx 1 root root 27 Jan  1  1970 /var/cache/apt/archives -> /tmp/var/cache/apt/archives
lrwxrwxrwx 1 root root 17 Jan  1  1970 /var/lib/dhcp -> /tmp/var/lib/dhcp
lrwxrwxrwx 1 root root  9 Nov  2 05:26 /var/lock -> /run/lock
lrwxrwxrwx 1 root root 12 Jan  1  1970 /var/log -> /tmp/var/log
lrwxrwxrwx 1 root root  4 Nov  2 05:26 /var/run -> /run
lrwxrwxrwx 1 root root  7 Nov  2 05:26 /var/spool/mail -> ../mail
lrwxrwxrwx 1 root root 12 Jan  1  1970 /var/tmp -> /tmp/var/tmp