www.encoco.net

How to create a passwordless Linux guest account

This is another way to create a Linux guest account. This can be used instead of a sometimes depreciated one. It has the advantage, it works on more systems and functionality is better like no problems to start Firefox. It works on single user systems only and holds data until system shutdown (one could use a logout event to trigger data deletion). It uses a template user (here guest_prefs) to configure the guest environment.

The core of this functionality is a script (here /roo/guest-init.sh) which goes as follows:
mkdir /home/guest
mount -t tmpfs tmpfs /home/guest
adduser --home /home/guest --quiet --gecos "" --disabled-password  guest
rsync -ratv /home/guest-prefs/ /home/guest/
passwd -d guest
chown -R guest:guest /home/guest
(if --gecos is depreciated use --comment instead)

Finally to make it work change the user rights and add it to the crontab:
chmod 700 /root/guest-init.sh
crontab -e
#append: @reboot /root/guest-init.sh
#save and exit

To hide the template user on the logon screen edit /var/lib/AccountsService/users/guest-prefs and set SystemAccount=true

BTW:
  • You need to be ROOT to accomplish this.
  • The user's home directory needs to be in /home.
  • Tested on Ubuntu 24.04 and 22.04 January 2026


More Tips

Gitta's Kunstwerke



  
Breite :

Language:





      Cookies akzeptieren 