sudo apt-get install --no-install-recommends ubuntu-desktop-
-
Save jakobii/229545a9673e6e84258683f363879937 to your computer and use it in GitHub Desktop.
in this example our guest user will be named student
sudo adduser studentopen /etc/rc.local in your favoite test editor: gedit, nano, vim
sudo gedit /etc/rc.localCopy the following into /etc/rc.local.
#!/bin/sh
rm -rf /home/student/*
mount -t ramfs -o size=512M ramfs /home/studentThen run the following cmd in bash.
sudo chmod +x /etc/rc.local /etc/rc.local will now run at startup.
To test this run the following commands. any errors will be reported to you by systemctl.
sudo systemctl restart rc-local
sudo systemctl status rc-localthe above script only runs at statup. which is nice since it setup the home directory to run in memory and not on disk. however we also probably want a cleanup script to run when users login.
edit /etc/profile
sudo gedit /etc/profileappend this to the bottom of the file. all we are doing in the rebuild section is copying some default information into the guest accounts home folder. exactly what gets copied is pretty easy to customize to fit your needs. (e.g. cp -r /opt/student/. /home/student/)
#remove everything
rm -rf /home/student/*
#rebuild
cp -r /etc/skel/. /home/student/
mkdir /home/student/Desktop
mkdir /home/student/Documents
mkdir /home/student/Downloads
mkdir /home/student/Music
mkdir /home/student/Pictures
mkdir /home/student/Public
mkdir /home/student/Templates
mkdir /home/student/Videos
#change folder owner
chown -R student:student /home/studentnow login to your guest account and test it out. try creating some test files and then log out. when you log back in the files should be gone!
login as the guest user and make it pretty. then run
su -
cp /home/student /opt
chmod -R 755 /opt/studentIMPORTANT! make sure you remove hidden files from the /opt/student. only keep .bash_logout, .bashrc, .profile. you do not need to delete hidden folders. some hidden files contain session specific information.
edit /etc/profile
sudo gedit /etc/profileand replace
#rebuild
cp -r /etc/skel/. /home/student/
mkdir /home/student/Desktop
mkdir /home/student/Documents
mkdir /home/student/Downloads
mkdir /home/student/Music
mkdir /home/student/Pictures
mkdir /home/student/Public
mkdir /home/student/Templates
mkdir /home/student/Videos
with this
#rebuild
cp -r /opt/student/. /home/student/
sudo passwd root
sudo apt-get update
sudo apt-get install lightdm
sudo nano /etc/lightdm/lightdm.confadd the following to /etc/lightdm/lightdm.conf.
[SeatDefaults]
greeter-session=unity-greeter
user-session=ubuntu
greeter-show-manual-login=true
you can do this in the settings gui- Settings->Details->Users. select the user and toggle automatic login.
Here is how you do it from the command line.
sudo gedit /etc/gdm3/custom.confuncomment the following. set AutomaticLogin = <username>.
# Enabling automatic login
AutomaticLoginEnable = true
AutomaticLogin = student
you may have created some user accounts that you do not want to display on the login page. to delete them use the following command. replace <username> with the user you would like to delete. -r will delete there home folder as well so be careful!
userdel -r <username>