Skip to content

Instantly share code, notes, and snippets.

@mattyclarkson
Created April 2, 2015 22:33
Show Gist options
  • Save mattyclarkson/bb281d0074c37ae9dd95 to your computer and use it in GitHub Desktop.
Save mattyclarkson/bb281d0074c37ae9dd95 to your computer and use it in GitHub Desktop.
Systemd Volatile Guest Account
useradd -m guest
chown guest:root /home/guest
chmod -w /home/guest
userdel guest
useradd -d /mnt/guest guest
passwd --delete guest
#
# /etc/fstab: static file system information
#
# <file system> <dir> <type> <options> <dump> <pass>
# [...Normal HDD mounts...]
tmp /mnt/guest tmpfs uid=guest,gid=guest,mode=0700,size=500M,nosuid,nodev,rw,noatime 0 0
[Unit]
Description=Volatile Guest Home
Before=systemd-user-sessions.service
[Service]
Type=oneshot
ExecStart=/usr/bin/rsync --archive /home/guest/ /mnt/guest
ExecStartPost=/usr/bin/chmod +w /mnt/guest
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment