This question already has an answer here:

I just installed Ubuntu Linux (16.04 LTS) last night. This is the first copy of Linux I've installed. I did use Linux for maybe a few weeks over 10 years ago, but I was very young at the time and didn't really understand its significance.

One of the first things I wanted to do after using this operating system was remove the guest login feature out of an abundance of caution.

I did a Google search and came across this website that instructs one to enter a couple lines of code into a terminal window to remove the feature: http://ubuntuhandbook.org/index.php/2016/04/remove-guest-session-ubuntu-16-04/

I wish I had done more research on the issue before entering this code (I guess since the domain looked legitimate, it showed up among the first Google Search results, the author seemed knowledgeable, and the code didn't "look" malicious, I assumed everything would work out the way it should). But, upon entering the first code and entering my password (see the code below), I got an error message that said the directory or file already exists. This is the code in question:

sudo mkdir /etc/lightdm/lightdm.conf.d

As I said, I believe the error message was letting me know that file or directory already exists. I then read the comments on the post and saw that people found inaccuracies in the code.

But when I entered the second piece of code (see below), I did not get an error message. Upon restarting my computer, the guest login feature was removed. The code:

sudo sh -c 'printf "[SeatDefaults]\nallow-guest=false\n" > /etc/lightdm/lightdm.conf.d/50-no-guest.conf'

For posterity's sake, this is how the author recommends reverting the code to bring back the guest login feature:

sudo rm /etc/lightdm/lightdm.conf.d/50-no-guest.conf

My concern is that, since the first piece of code seemed to give an error message or the like, this code may have done something untoward to the operating system. Could someone let me know if this is the case, or reassure me if it's not?

EDIT: 2017-07-05 @ 20:20 UTC

See also this newer thread that addresses my questions, "How Do I Revert Ubuntu 16.04 LTS to Its Original State? Is a Clean Install Necessary?" How Do I Revert Ubuntu 16.04 LTS to Its Original State? Is a Clean Install Necessary?

marked as duplicate by Charles Green, Terrance, Pilot6, Eric Carvalho, muru command-line Jul 6 '17 at 6:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • The commands look correct. It doesn't have to be 50-no-guest.conf. You can create any you want. I have actually done this before and in this answer askubuntu.com/a/731455/231142 removes even the list of names of the user accounts on the system at the login screen. – Terrance Jul 5 '17 at 20:28

mine reads :

[SeatDefaults]
greeter-session=lightdm-greeter
greeter-hide-users=false
session-wrapper=/etc/X11/Xsession
allow-guest=false

to revert, launch a text editor with sudo privelage and change allow-guest=false to allow-guest=true

greeter-hide-user changes if you want the last user automatically put in the login box and focus on password.

  • greeter-hide-user={true|false} actually is used to display, or not display, the list of users on the login screen. Setting this to true forces the user to know a specific username and password, and is done for security reasons. See more /usr/share/doc/lightdm/lightdm.conf for more info. – heynnema Jul 6 '17 at 1:22

You don't need to worry about that first error message. At the time when the tutorial was written, the /etc/lightdm/lightdm.conf.d folder didn't exist by default. In the latest point release of Ubuntu 16.04 it does exist, so creating it isn't necessary.

The instruction origins from the official Ubuntu desktop guide:

https://help.ubuntu.com/16.04/ubuntu-help/shell-guest-session.html#disable

  • The link is dead @Gunnar – Nam G VU May 4 at 18:17
  • @NamGVU: Thanks for pointing it out. Fixed now. – Gunnar Hjalmarsson May 4 at 18:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.