Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Lost my password and lost my way. I’m in the process of learning Centos7 and had to move to another project for the last month. Returned to my computer and realized I didn’t write down my password anywhere. Oops.
So I went on line and found this solution:
1 - At the boot menu, press e to edit the existing kernel
2 - Next, scroll down to the list until you see the line underlined below ( ro ) . What we need to do is change that ro to rw and start into a bash shell. It should look like this rw init=/sysroot/bin/sh.
//So far so good. I’m now in the shell. However the next instruction is to type “chroot /sysroot” at the prompt. The prompt in the instruction, however, is :/# and my prompt is dracut:/#
//When I type chroot /sysroot at my prompt (dracut:/#), I get “failed to run command ‘/bin/sh’: No such file or directory.
//After this, the instructions are to create a new password via:
3 - Finally, run the commands below to change the root password - passwd root
4 - You’ll be prompted to create and confirm a new password. After creating the password, run the commands below to update SELinux parameters - touch /.autorelabel
The way I've usually gotten around that is to enter "init = /bin/bash" as a kernel boot option (in GRUB 2, select CentOS 7, press "e", and add it to the line that says "linux" or "linux16"). At the resulting bash shell, you can use passwd to reset the root password, then do an ugly reboot since systemd wasn't loaded. If you're using an older system, you may have to hook up a PS/2 keyboard for this to work.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.