Well I know the question is weird, but i have a user "Bob" and I want only bob's account to be stuck in infinite login loop. Please note I don't want to get out of a login loop..I want this particular user to be stuck in infinite login loop.

How do I do this?

  • 3
    The OP only wanted the user Bob to go into infinite login loop. It is obvious he is concerned with GUI login screen, thus changing permissions/ownership of .Xauthority is enough – Faizan Akram Dar Apr 13 '15 at 19:26
  • 1
    Why would you do such a thing? – Elder Geek Apr 13 '15 at 20:37
  • 1
    Please review ubuntu.com/about/about-ubuntu/conduct – Elder Geek Apr 14 '15 at 0:38
  • 5
    I think this should a stack exchange site "How to mess with your coworkers" – Igor Putilov Apr 14 '15 at 1:13
up vote 5 down vote accepted

Open Terminal (Press Ctrl+Alt+T). Execute this command in terminal.

chown -R root:root /home/Bob/.Xauthority

This command with change ownership of .Xauthority directory of Bob user to root user thus not allowing Bob to login.

  • 13
    The user can still log in via other means, ssh or kerberos to name a few. Set the users shell to /bin/false , that will prevent login. – Panther Apr 13 '15 at 19:06
  • 1
    @bodhi.zazen I've addressed that – Sergiy Kolodyazhnyy Apr 13 '15 at 20:02
  • 7
    Restart your system? This isn't Windows were talking about! – Ernest Friedman-Hill Apr 13 '15 at 23:51
  • 6
    Reboot your system? This isn't Windows we're talking about! – 200_success Apr 14 '15 at 4:43
  • 3
    You already got the comments explaining the downvotes. One issue, the superfluous reboot, has been fixed by A.B.'s edit. (Unlike Windows users, many Linux users care about uptime. Unnecessary reboots are considered bad advice — and reboots are rarely necessary.) The second issue, that this answer only prevents X session logins, in an easily circumventable way, is a fatal flaw with this answer. The user can still log in through a text console (Ctrl-Alt-F1). Once logged in, Bob can rm .Xauthority, even though the file is owned by root. Then your entire solution is defeated. – 200_success Apr 14 '15 at 9:04

To address bodhi's comment that the user can login through other means, open the file /etc/security/limits.conf and at the bottom add the following line

username hard maxlogins 0

The user will be able to login in tty but will be kicked out immediatelly, and lightdm (or any other login manager for that matter) will do the same. For good measure I would use this together with chowning .Xauthority

Change the shell for Bob:

sudo chsh -s /bin/false Bob
  • This is the normal way. Due to the way xlogin works it still invokes the shell so it still fails out. – Joshua Apr 13 '15 at 21:23
  • 2
    Please read this: SSH Security and You - /bin/false is not security – nyuszika7h Apr 14 '15 at 12:16
  • 1
    What does security have to do with this question, which the OP has asked? – A.B. Apr 14 '15 at 12:17

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.