I wanted to login as a user, but when I typed in login usr (usr is just a placeholder for the user name) the system returned:

login: Cannot possibly work without effective root. 

How can I fix this?


You can make the login command succeed by running it as root (as the error message says).

You can run login username as root by using sudo:

sudo login username

Unless you've very recently run a command with sudo in the shell you're already in, you'll first be prompted to enter your password as an administrator who is able to run commands as root with sudo.

Then the login command will run, it will prompt for username's password, and if the password is successfully entered, you'll get a login as username.

However, you probably do not need a real login as username:

  • To start a login shell as username, run:

    sudo -i -u username

    This requires no authentication except for the initial sudo authentication (when you enter your password, not username's password). Only administrators can do this.

  • To start a login shell as username, such that you are prompted for username's password (and not prompted for your own password), run:

    su - username

    Any user (except Guest) can do this, provided that they know username's password.

For more information about running commands as root, see the community documentation.

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.