Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I’m trying to execute the login command but it fails.

As root (via SSH) I get:

root@server:~# login
Connection to closed.

The SSH connection is closed. In a “physical” TTY the session is closed and I go back to the login screen.

As a regular user using sudo:

bilbax@server:~$ sudo login

[1]+  Stopped                 sudo login

Just before this bug appeared, I tried to use the login command as usual, it worked, it asked for the password. I typed it wrong, I retried, but the command froze. I tried ^C, without success. So, as root, I executed killall login; didn't worked too. I rebooted the system and now I have to bug described above.

Did I do something wrong by killing the command?

I’m on Arch Linux x86_64 (kernel 3.4.7-1-ARCH).

share|improve this question
You shouldn't need to run login at all. What are you trying to do? – Michael Hampton Aug 11 '12 at 22:34
I need to launch my Minecraft server under the minecraft account. I can’t use su minecraft, it causes problems with screen which can’t start. So I logged into minecraft use using login as root, and start the server. – Kévin Lesénéchal Aug 11 '12 at 23:04
@KévinLesénéchal su is the proper way to do what you want, not login. If you're having a problem getting screen to work with su, you should open question on that instead. – Patrick Aug 12 '12 at 3:46

The problem with su will be that it doesn't chown the tty to the new user. That doesn't matter when you're su'ing to root, but for other users not owning the tty leads to difficulty.

Running login from the shell used to be a normal (or at least acceptable) thing to do. Shells treated it specially, implicitly doing an exec. Modern shells don't seem to do that any more. Running exec login explicitly might help. Adding -f username is another thing to try.

When you do it as a non-root user, it only works if login is setuid-root, which used to be the standard setup but isn't so common anymore. The sudo version might also work if preceded by exec, assuming sudo is smart enough to get out of the way (i.e. do a direct exec itself, not a fork+exec+wait)

After going through all that I wonder why you don't just ssh host -l minecraft and cut out the middleman

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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