My OS is Ubuntu 14.04 64-bit, and kernel is 3.13.0-30-generic. I forget my user account password and now want to get into GUI desktop.

I know from the Internet that we can reset password by single user mode. Usually this is done by editing grub2 items, like this "How do I boot into single-user mode from GRUB?", and this "Ubuntu 12.04 Grub to boot into single user mode "

From the links, I can renew account password under shell, reboot, and login into desktop with the new password. But I don't want to renew the password, I simply want to login to the desktop.

I have tried the command startx but it failed giving the following error:

error in locking authority file .Xauthority

I have searched the directory "root" and found no such file.

How can I achieve my goal? Is it possible?


Single user mode runs at level 1 which is text mode. If I need X window, Linux must run at level 5.

So I cannot get into GUI desktop at single user mode.

But why I cannot use command startx at single user mode, remains to be solved.


I am at root text mode (at runlevel 1 of course) now through the reference link above. I can change any password now and reboot into GUI. But I would like to get into GUI by a "GEEK" way. That is bypassing the login screen of GUI and get there directly without password.

  • 2
    Why do you boot into single user mode if you want to start the desktop ? You also tagged your post "autologin", which is not the same thing. See here for how to enable automatic login.
    – Leiaz
    Jul 3, 2014 at 19:50
  • @Leiza Because I lost my password, but I don't want to reset it since I put down my password somewhere at home. Do you mean desktop mode conflicts with single user mode?
    – Zachary
    Jul 4, 2014 at 5:23
  • 1
    "Single user mode" is less than "text mode" (runlevel 3 in Sys V init). It means no services are started (network...), non essential partitions (/home ...) are not mounted ... But this was for Sys V init, Ubuntu uses Upstart, which doesn't really have "run levels". It still means Upstart stops early. Running just X won't be enought to have a "functional" desktop. I don't use Ubuntu and don't really know Upstart, but if you want to learn more, poke around your system, see what jobs have ran at your runlevel, which would run to fully boot ...
    – Leiaz
    Jul 4, 2014 at 12:33

1 Answer 1


First of all the different runlevels are simply a question of what services are running. X (the GUI) does not start by default on runlevel 1 but that doesn't mean it can't. However, the Right Way® to start a graphical session from runlevel 1 is not to run startx but to start the login manager:

sudo service lightdm start

That should bring up your normal login screen and let you log in as usual.

I'm not sure why you got that .Xauthority file. This is normally due to the file existing already but not owned by the user who is attempting to start X. You haven't clarified whether you're running startx as root or as your regular user but in either case, the fix is usually to remove .Xauthority. So, whichever user you are, just run

rm ~/.Xauthority 

That should let you run startx but, again, you don't want to and will probably run into other problems down the line if you try it this way. Use lightdm instead.

  • I searched the Internet, and found "startx" will bring me the X window. Why need lightdm, but not startx? By the way, can I bypass the login screen and get into the desktop through tools like "lightdm"?
    – Zachary
    Jul 4, 2014 at 11:16
  • @Zachary startx is quite old and is normally not used anymore. If you want to use it, you'll need to set up your ~/xinitrc to launch your desktop environment. I think the file doesn't even exist on the default Ubuntu. So, yes, you can bypass it but by using xinit. However, that will need to be set up and is really not worth it. Just change your password and then, if you ever find your old one, change it back again. You seem to be making your life complicated for no reason. You still haven't explained what user you are logging in as.
    – terdon
    Jul 4, 2014 at 11:28
  • I am using the single user mode command line. I achieve this by editing the grub menu by appending "single". I can also use the grub recovery mode. Both of them bring me into the root command line (text mode, no password need).
    – Zachary
    Jul 4, 2014 at 11:37
  • @Zachary OK, please add that info to your question. You should be aware that running the GUI as root is a very bad idea. Please use my suggested approach with lightdm instead of attempting to fix startx. You would have to run it as your regular user, not as root, anyway or else you won't have your regular desktop session. Seriously though, just change your password.
    – terdon
    Jul 4, 2014 at 11:45
  • 1
    @Zachary 1) many systems won't let you; 2) You are likely to break things without meaning to; 3) Any attacker that gains access can destroy your machine; 4) you won't have your settings and documents available where you expect them; 5) Any files you touch will now be owned by root, not you and that can both break things and cause complications in general; 6) certain programs refuse to be run as root.
    – terdon
    Jul 5, 2014 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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