17

Sometimes I have friends in my house that want use my computer. How can they use a guest account without typing a password?

1
  • The answers are out of date. Jul 15, 2019 at 0:30

5 Answers 5

11

Method 1

user@ubuntu:~$ sudo adduser guest
user@ubuntu:~$ sudo passwd -d guest

This will add a user called "guest", then delete her password. You can log in from both the standard getty login prompt and graphical login managers like GDM. This works for me on Ubuntu 10.10.

However, apparently this doesn't work for some people using Ubuntu. Thus:

Method 2

  1. Make a user.

  2. Open /etc/shadow: gksudo gedit /etc/shadow

  3. Find the line that starts with the user you just made. Notice the line has multiple fields separated by colons.

  4. Change the second field to: U6aMy0wojraho. In my case:

    guest:$6$m4CpcgBw$i9XLGaUNToClOJ1X5Grug/COUjlkhoPv1:15048:0:99999:7:::

    becomes:

     guest:U6aMy0wojraho:15048:0:99999:7:::
    
  5. Save the file, log out, and try your new password-less account.

The origin of this method is from the Ubuntu livecd. The default user (ubuntu) requires no login password. If you look at /etc/shadow on the livecd, U6aMy0wojraho is the encrypted form of the magic password used. I explain this to emphasize this is not a general linux solution, but something specifically Ubuntu.

2
  • 1
    this can be done with single command: useradd -m -p U6aMy0wojraho guest May 5, 2016 at 7:53
  • ...or for an existing user with echo test-user-0:U6aMy0wojraho | sudo chpasswd -e source
    – Frank N
    Mar 4, 2021 at 12:50
6

There will be a guest account by default.Try clicking your username at the top-right corner and activate "Guest Session" under there. Also see the posts below,

Passwordless Guest Account

Creating a Guest Account

1
2

Create a new user, without administration access, then click in: "No passwd at login". This may solve your problem, but you can log in, and at your name (at right up): Guest-session.

0

Here's how I created Guest Account without password with tmpfs (RAM is used as disk space)

# Run these as root or prefix sudo
useradd -c "Guest [click here]" guest    ; # add a user named
passwd guest     ; # just give any password
passwd -d guest  ; # delete the password to make password less login
UserID=$(id -u guest) ; # to set ownership of /home/guest directory
GroupIP=$(id -g guest); # get the group id for home directory permission
usermod -aG audio,plugdev,video,netdev,bluetooth guest ; # give device access (this is for debian)
rm -rf /home/guest    ; # in case there are files/directories
mkdir -pv /home/guest ; # should mount if non empty but make sure it is empty 
echo "tmpfs /home/guest tmpfs rw,size=1024M,nosuid,uid=$UserID,gid=$GroupID 0 0" >> \
/etc/fstab
mount /home/guest

Now you can login with guest without password everytime and data is stored up to 1GB in RAM which will be deleted on system shutdown!

-1

I just found this guide (which dates back to 2010) that uses the guest-session instead of creating a user. A guest-session has a higher security settings by default, doesn't allow access to filesystem files on nautilus and all files are deleted upon logout since they're stored on /tmp.

Here is the content of the above link, a post originally created by @Kainalu:

Moderators - I don't know where I learned how to do this, and couldn't find it, so I decided to post here. If this is a dupe, or the wrong place for this, please moderate accordingly.

I learned how to do this on the 'net somewhere. This HowTo will help you create an account on the login screen that will log in the same guest-session seen in the user menu. The advantage of this is that it will be an easily accessible guest account, while not preserving any files or changes on logout, and a higher security model for the account. Confirmed to work on 10.04 - 10.10, but the directions are for 10.10

  1. Under an existing administrator account, go to the menu entry System --> administration --> Users and Groups

  2. Click Add. you may need to provide a password at this point. Name your new user anything you would like, except guest. The account cannot be called guest, but visitor does nicely. encryption of the account is not needed. This account will be a "booster" account to guest-session

  3. On the next screen, enter a password, and make sure that you click the check box "Don't ask for password on login", Click OK to finish

  4. As an extra precaution, click Advanced settings, when back on the Users and Groups screen, and on the User Privileges tab, uncheck Monitor System Logs.

  5. Exit the Users and groups menu, and then log out and into your new account

  6. Once there, make a folder called GuestManager, and in that folder, make a plain text file called Guestmanager.sh, with this code in it :

Code:

#!/bin/bash

# Launches the guest session
/usr/share/gdm/guest-session/guest-session-launch
# Logs the user when done
/usr/bin/gnome-session-save --logout
  1. Save that and then right click on it, go to properties, and then go to the permissions tab. On this tab, click "allow executing file as program", and then close that window.

  2. Open the menu entry System --> Preferences --> Startup Applications, and once there, turn off all the startup applications, and then click add. Fill in the name and comment as GustManager, and for the command, enter /home/visitor/GuestManager/GuestManager.sh, where visitor would be the name you picked for the account in step 2. click add, then close

  3. Delete all applets and extra toolbars (might want to leave the main gnome menu), and set the background to black or something else bland, and log out. Since this account is just a "booster" none of these toolbars and such will be needed, so removing them saves memory and load time.

  4. ENJOY!

2
  • 1
    Obligatory "Its encouraged to post the substance of a link in the body of the answer, so as to atleast prevent potential and enevitable link-rot" comment. :) Jan 22, 2016 at 7:14
  • @ThorSummoner Just for the record the "obligatory" remark is more or less true in Stack Overflow where it is common practice that answers with links to code without embedded are code are deleted. It was explained to me that this is because of concerns that this code may be intellectual property. However links to Ubuntu forums posts are permanent and the content isn't going anywhere soon, so there doesn't seem to be any reason to delete these posts because of concerns that the linked content will disappear. I also don't downvote such posts. If I didn't like the post I'd delete vote it instead.
    – karel
    Jun 26, 2019 at 21:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .