root passwd
Hi all,
Noobie to linux. Accidentally removed my root password. Tried doing to set it, and it returned but doing again didn't prompt me for a password. What am I doing wrong here?
23 Replies
How soon after the first
sudo
command are you running the next one?
The password is effectively cached for a little bit before you have to reenter itcached for 5-7 mins by default in most distros isnt it?
I restarted my pc after setting the password. Does that clear the cache? Interestingly, after doing while logged into root, the password actually applied to my user account (dan).
My root account was still passwordless
the root account (named root) is disabled
only able to be logged into using
sudo su
and should never be enabled for direct login
if you need root permissions use sudo, which will ask for your normal admin users passwordmb, i didn't mean login as in through the login screen, i just meant i tried using some sudo commands and was not met with a password prompt
which you set with
passwd
without sudo
restarting will clear the cached password
you can also force the password to be asked for again by invalidating the cache with sudo -k commandyouwanttorun
sudo -k nano /test.txt
didn't prompt me for a password
i have done the following:
sudo -i
passwd
(set password here)
Password updated successfully.
tried a sudo command, no password prompt.
restarted pc
tried another sudo command, still no password promptsudo passwd -dl root
i think is how you re-disable the root password
however make sure that sudo from your admin account works first so you dont lock yourself out without admin access
anyways i need to go get some sleep its almost 3amoh yeah i should note, i did
sudo passwd -d dan
which is how i ended up with no root password
good night! thanks for the assistancethat removed your password
just set it with
passwd
againi thought passing a user to the command deleted it for that user only?
yes but running without a password is a super dumb idea
and youre effectively giving us devs a license to make fun of you since its worse than not changing the default password
didn't really intend to get made fun of, just thought that having a password on the root user would be sufficient
again, linux noobie
its ok
its your users password that is used when you elevate with sudo
not the root password
but doing
sudo -i
followed by passwd
will set the password for the root account
but if you already ran sudo passwd -d dan
you would have made sudo
require no password
and the other one would have made it so the root account login would workthat makes more sense. interesting interaction though, i thought running sudo would ask for the root password. learned something new today
so running sudo will always ask for the current user's password?
yes
i should add, even if i have a root password set?
and if the user is in the wheel group (admin group) then you get root permissions for the 1 command
having a root password set is highly not recommended
elevate using sudo and your own password
this is why we disable the root password configuration in the installer so the root account stays disabled, because people keep footgunning no, footshotgunning themselves repeatedly
i personally prefer footrocketlauncher but that's just me. well, thanks for disabling that functionality to protect people like myself XD.
all i have to do is set my dan password right?
side note, is there any way to make it so i don't have to enter my password on boot? while still maintaining a user password
set password on your account
Solution
then disable and lock the root account
enable autologin
Those both worked for me. Thank you!