21 Comments to “Ubuntu Tip:How to disable guest account in ubuntu 12.04(Precise)”

  1. danrgmc says:

    You might add to this the fact that there is a bug in lightdm that affects some of us that causes lightdm to ONLY boot to the guest account unless the above action is taken.

    [Reply]

  2. Sergio says:

    Please add a warning saying that after executing sudo restart lightdm all graphical programs running will be closed.

    [Reply]

    ruchi Reply:

    Thank you and i have updated in the main article

    [Reply]

  3. shejuguru says:

    Thanks a lot for this piece of information.

    [Reply]

  4. Vishal says:

    Thanks a lot. I have to do it. Thanks very much.

    [Reply]

  5. Kalimuthu says:

    Hi,
    I’ve made the changes but guest account is not disabled mean it’s login.

    Thanks,
    –Kalimuthu

    [Reply]

    Sarthak Reply:

    Copy paste the below lines. It will work.

    [SeatDefaults]
    user-session=ubuntu
    greeter-session=unity-greeter
    allow-guest=false

    [Reply]

  6. Hank22077 says:

    Thank you for this. All I really wanted was to prevent my kids from guest login w/o permission. So, I really wanted to just be able to make it like 10.04LTS, where I’d have to be logged in to allow the guest access; but, this works just fine.
    However, if you know how to allow guest access from an admin account please let me know. So far, this is the only option I’ve found. Thanks

    [Reply]

  7. Felippe Castro says:

    Thanks, works fine!

    [Reply]

  8. Alberto says:

    As danrgmc says, there’s a bug in lightdm, it only boot in guest account.
    For writing that file, we need the default root password. Do you know what is the default root password in the prebuilt images?

    [Reply]

  9. Francis Massolin says:

    @Alberto:
    There is nothing as such as a default root password in Ubuntu. The OS was designed to enforce the use of your user account, rather than using root for every admin task. Instead the system relies on SUDO to run any process that requires root privileges. In plain english, it means that to run any process requiring root privileges, you must use the following syntax:

    #sudo + command + commmand’s options
    e.g: sudo apt-get dist-upgrade

    You will then be asked for the admin password, which is in fact your own user account password, the one you’ve created when you installed the system for the first time. That account was automatically added to the admin list in SUDO (/etc/sudoers – don’t mess with this file unless you know exactly what you’re doing!)

    Having said that, sometimes it can be obviously annoying to not being able to log in as root. To do so, you must first ‘activate’ that account, which consist in allocating a password to root :

    #sudo passwd root
    Then enter your new password (a strong one).

    Now the root account is ‘activated’ and you can use the command “su – root” to open a shell session with root.
    Opening a new shell session with “su” is a safer way to use the system than to log on as the root user, something I personally do not recommend.

    Of course, if you make a mistake when using the root account you will feel sorry for yourself…
    With great power comes great responsibilities. ;o)

    [Reply]

  10. Pouya says:

    thanks alot, but i cannot edit lightdm.conf

    i don’t have permission for that :(

    what should i do?

    [Reply]

    Eric Reply:

    Maybe you don’t have root acces ?

    [Reply]

  11. Mac says:

    Thanks.

    [Reply]

  12. Diogo says:

    Thanks!

    [Reply]

  13. Eric says:

    Thanks for article is useful.

    [Reply]

  14. amy1234 says:

    so can someone please tell me why the last command is on there if this is for Disabling a guest account?! and if there is a way to change it back thanks

    [Reply]

    amy1234 Reply:

    also when i entered the last command into the terminal it pretty much killed my computer, thanks, i will admit i was being careless but come on why is that in Guest account disabling?!

    [Reply]

    Mike Reply:

    If you entered into an empty file to enter the suggested setting,

    do this:

    1. Reboot into recovery
    2. mount -o rw,remount /
    3. rm /etc/lightdm/lightdm.conf
    4. reboot

    * Others, if you already had entries in the file, please DO NOT perform these steps, as it may cripple you OS beyond recovery….

    [Reply]

  15. Doug says:

    As amy1234 did, I went throught the process of adding the allow-guest=false to the file and hit save. went to terminal and entered sudo restart lightdm
    I believe I hit enter, and the computer is now on a blank screen with a cursor mark in the top left corner.
    I did a hard reboot, and it went straight to the same blank screen.
    What to do?
    Thanks for any help.
    Doug

    [Reply]

  16. alex says:

    this command fucked up my ubuntu 13.10
    sudo restart lightdm

    it cant boot anymore
    i used to reinstall it

    [Reply]

Leave a Reply