No effective root
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, notusername
's password). Only administrators can do this. -
To start a login shell as
username
, such that you are prompted forusername
'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.
Related videos on Youtube
elder4222
An aspiring programmer who has some (moderate) knowledge of C, Java, and Python, and some basic knowledge of shell scripting.
Updated on September 18, 2022Comments
-
elder4222 over 1 year
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?