Thursday, September 3, 2026

How to Create a New User and Enable the Login Screen in Ubuntu

If your Xubuntu virtual machine boots directly to the desktop without showing a login screen, automatic login is probably enabled.

This guide shows how to create a new user called user1, set a password for the account, and disable automatic login so that Xubuntu displays the login screen whenever the VM starts.

Creating a New User in Xubuntu

1. Create the User

Open a Terminal and run:

sudo adduser user1

Follow the prompts to create the account. You will be asked to enter a password and some optional information about the user.

You can press Enter to skip optional information such as the full name, room number, and phone number.

2. Set or Change the Password for user1

If you need to set a password for user1 later, or simply want to change the existing password, run:

sudo passwd user1

You should see prompts similar to:

New password:
Retype new password:
passwd: password updated successfully

When entering a password in the Linux Terminal, nothing will appear on the screen. You will not see characters, dots, or asterisks while typing. This is normal behavior.

3. Give user1 Sudo Privileges (Optional)

By default, the new account does not necessarily have administrative privileges. If you want user1 to be able to execute commands using sudo, run:

sudo usermod -aG sudo user1

This step is optional. If user1 should remain a normal user without administrator privileges, you can skip it.

Enabling the Xubuntu Login Screen

4. Check the Display Manager

Xubuntu commonly uses LightDM to provide its graphical login screen. You can check which display manager is currently configured by running:

cat /etc/X11/default-display-manager

On a typical Xubuntu installation, the output should be:

/usr/sbin/lightdm

If you see /usr/sbin/lightdm, the following LightDM configuration steps apply to your system.

5. Check Whether Automatic Login Is Enabled

Search the LightDM configuration files for settings related to automatic login:

grep -R "autologin" /etc/lightdm/

You may find configuration similar to:

[Seat:*]
autologin-user=myuser
autologin-user-timeout=0

The important setting is:

autologin-user=myuser

This tells LightDM to automatically log in to the specified account instead of displaying the normal graphical login screen.

6. Disable Automatic Login

If the automatic-login configuration is located in /etc/lightdm/lightdm.conf, open the file using Nano:

sudo nano /etc/lightdm/lightdm.conf

Look for configuration similar to:

[Seat:*]
autologin-user=myuser
autologin-user-timeout=0

Comment out the automatic-login lines:

[Seat:*]
#autologin-user=myuser
#autologin-user-timeout=0

Alternatively, you can remove the automatic-login lines completely.

If the earlier grep command shows that the settings are stored in another file under /etc/lightdm/, edit that file instead.

When using Nano:

  • Press Ctrl+O to save the file.
  • Press Enter to confirm the filename.
  • Press Ctrl+X to exit Nano.

Testing the New User Account

7. Test user1 from the Terminal

Before rebooting the virtual machine, you can verify that the new account and password work correctly. Run:

su - user1

Enter the password that you configured for user1.

If authentication succeeds, the shell will switch to the new user's environment. You can verify the current username with:

whoami

The output should be:

user1

To return to your original account, run:

exit

Rebooting and Verifying the Login Screen

8. Reboot Xubuntu

After creating the user and disabling automatic login, reboot the virtual machine:

sudo reboot

When Xubuntu starts again, LightDM should display the graphical login screen instead of automatically opening the desktop.

You should now be able to select your existing account or user1 and log in using the corresponding password.

Quick Command Reference

# Create a new user
sudo adduser user1

# Set or change the user's password
sudo passwd user1

# Optional: give user1 sudo privileges
sudo usermod -aG sudo user1

# Check the current display manager
cat /etc/X11/default-display-manager

# Find LightDM automatic-login settings
grep -R "autologin" /etc/lightdm/

# Edit the main LightDM configuration
sudo nano /etc/lightdm/lightdm.conf

# Test the new account
su - user1

# Check the current username
whoami

# Reboot Xubuntu
sudo reboot

Conclusion

If Xubuntu boots directly to the desktop, automatic login is usually enabled in the display manager. Creating another user alone does not necessarily cause the login screen to appear.

After creating user1, setting its password, and disabling the autologin-user option in LightDM, the graphical login screen should appear whenever Xubuntu starts. You can then choose which account to use each time the virtual machine boots.

No comments: