7

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?

Seth
  • 59,332

4 Answers4

11

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

Seth
  • 59,332
7

Change the shell for Bob:

sudo chsh -s /bin/false Bob
A.B.
  • 92,125
5

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.

A.B.
  • 92,125
Faizan Akram Dar
  • 4,569
  • 1
  • 25
  • 31
-1

If the purpose is to prevent login of the user Bob, I suggest you can also lock the user password and expire his account using:

passwd -l bob
usermod --expiredate 1 bob

This blocks also ssh login with keys. There is more info in how to enable or disable an user question.

Fjor
  • 314
  • 2
  • 10