passwd -d michal <===> smazani hesla uzivatelovi michal (umoznene pouze rootovi ci uzivatelovi s pravem sudo)
passwd -l michal <===> zamceni hesla uzivatelovi michal (umoznene pouze rootovi ci uzivatelovi s pravem sudo). Po zamceni se uzivatel nemuze prihlasit k uctu, i kdyz vlozi spravne heslo
passwd -u michal <===> odemceni hesla je umozneno pouze rootovi ci uzivatelovi s pravem sudo. Po odemceni muze byt heslo smazano. Takze nove heslo pro uzivatele muze byt nastaveno rootem.
passwd -x 30 michal <===> pokud je potreba po urcitem casu menit uzivatelovo heslo (v tomto prikladu 30 dni) Nastaveni je umoznene pouze rootovi ci uzivatelovi s pravem sudo. Po 30 dnech heslo automaticky vyprsi a system se nasilne zepta na zadani uzivatelova noveho heslo.
passwd -S michal <===> zobrazi informace o heslu konkretniho uzivatele napr. #michal P 03/25/2022 0 99999 7 -1
#(1) uzivatelske jmeno
#(2) PS heslo zadane
#(2) PL heslo je zamknute
#(2) NP zadne heslo
#(3) datum kdy bylo heslo zadano
#(4) minimum age of password (days)
#(5) maximum age of password (days)
#(6) Reminder period before Expiry of password (days)
#(7) After expiry of Password, account become active (days)
passwd -Sa <===> zobrazi informace o heslech vsech uzivatelu
Change Your Own User Password
passwd
Change Another User’s Password
sudo passwd Another-User
LOST NORMAL USER PASSWORD / ZAPOMENUTE HESLO
$ su
root-password
# passwd nove-heslo-uzivatele
pote zadam nove heslo a pote jeste jednou potvrdim heslo
LOST ROOT PASSWORD / ZAPOMENUTE HESLO ROOTA
reset root password
boot with grub, hit e, select kernel line, as parameters add: quiet single init=/bin/bash, press enter and than b
mount -o remount,rw /
Jako prvni musim sve PC odpojit uplne od site (NETU) vyndam tedy ethernet kabel
1) nabootuju z prvniho instalcniho CD (nebo jakyhokoli LiveCD) a za prompt napisu
"linux single" (pro Knoppix pisu "knoppix single") a nabootuju do "single user mode"
a dostanu se do obstarozniho promptu neco jako "sh-2.05b#"
Pozn.: jeste je alternativni moznost: U vetsiny Live a RescueCD muzu take bootovat
do licesystemu, namountova partisnu a jako root udelat zmeny v souborech popsanych nize..
2) napisu:
#cd /etc <===> dostanu se do adresare etc
3) potrebuju udelat zmeny ve dvou soborech: "passwd" a "shadow"
#vi passwd <===> otevre se soubor passwd
zmacnu i <===> prepne program vi do modu vkladani
prvni readek vypada takto:
root:x:0:0:root:/root:/bin/bash
zmenim ho na toto:
root::0:0:root:/root:/bin/bash
(proste smazu to x a nevsimam si dvojtecek )
ulozim soubor >> dam Esc >> ZZ
4) #vi shadow <===> otevre se soubor shadow
zmacnu i <===> prepne program vi do modu vkladani
prvni readek je dlouha smes pismen, smazu jen pismena tudiz zustane toto (ctyri dvojtecky!):
root::::
ulozim soubor >> dam Esc >> ZZ
5) rebootuju PC >> prihlasim se jako normalni uzivatel>> otevru konzoli a pisu:
$ su
# passwd
a nastavim NOVE ROOT HESLO
6) odhlasim se jako root CTRL+D
A je hotovo, muzu vratit ethernet kabel zpet, rebootovat PC
moznost druha
do GRUBu se dostaneme takto: podrzete SHIFT pri bootovani PC, mezi ostatnimi polozkamy v menu vyberte “Advanced options”
pak zmacnete "e" abyste mohli editovat prikazy
Using your arrow keys once again, scroll down a bit until you see a line that begins with linux /boot/vmlinuz....
We will need to make some small changes to this line. Use the screenshot below for reference so you can make sure you’ve found the correct line.
The last part of this line is ro quiet splash $vt_handoff. We will need to replace this text with the following line. Make sure to first backspace
the current settings, then type these new ones. Note that on some distros, the line may be a little different,
but should definitely include the ro (read only) text, which needs to be replaced.
rw init=/bin/bash
This will give us write permissions as well as a bash shell, so we can use the usual Linux commands to change the root password.
Once you have made these changes, press the F10 key to save the changes and reboot your system.
You will be brought back into a bash prompt, but only on this first reboot. Subsequent machine boots will be back to normal.
Your root partition should be automatically mounted, with read and write permissions.
You can verify this by executing the mount command. If it’s not already mounted, use the following command below to mount it.
# mount -n -o remount,rw /
Now, simply use the usual passwd command to set a new root password.
# passwd
When done, we just need to reboot the system. The usual reboot and shutdown commands will not work.
Instead, execute the following command to reboot the system and load into the operating system like usual.
# exec /sbin/init
That’s all there is to it. Your computer should boot up like normal, and you will be able to
login to the root account (or use commands with sudo) while specifying the password you just set.
https://linuxhint.com/change_reset_root_pasword_linux