Thursday, January 25, 2018

Solve Any Rubik's cube - 24 step algorithm

Here is a great algorithm for solving Rubik's cube. Some times you don't have to go through all the way to the end. If it doesn't finished, continue from the beginning; it will finish eventually.
24 step algorithm

LR2BL'RU2
F2LBDU2B
L'R2B2L'D2U
LB2U2R2BD2


Tuesday, December 12, 2017

Reset CentOS 7 root password through Single User Mode

Reset CentOS 7 root password through Single User Mode
 
While i was learning centos i used to install os on virtual machines and give passwords that i feel like easy to remember and hard to forget. But trust me if i am opening these machines after a three or four days gap, it would be easy for me to create a new virtual machine and install from scratch....

But there is a method to reset the root password for CentOS. Actually this method is applicable for all linux distributions with small changes in parameters to access single user mode.

For earlier versions of centos is a slight different. For CentOS 7 follow the steps.

Turn on the machine
At the boot menu, press e to edit the existing kernel (Core) as shown below.
 
Scroll down

 
Change ro to rw and start into bash shell by adding a simple line of command init= /sysroot/bin/sh



Press Ctrl + X to boot into Single User Mode

You will get a # prompt. Enter the following command
chroot /sysroot



Then run the command to change password
passwd root



If you want to change password for other users than root use the same command changing the username.

passwd ratheesh

if you dont know the user login name just go through /etc/passwd file. For that enter the following command.

cat /etc/passwd



First field is the username or login. Here on the above image rpb is the login and Ratheesh PB is the full name of that user. if there are a lot of users you can use more or less command to sees pagewise

more /etc/passwd
less /etc/passwd

or you can use the following command to list only usernames

awk -F':' '{print $1}' /etc/passwd








If  you want to get list of all users other than built in system users use the following command








awk -F':' '{if($3 >= 1000 && $3 <= 60000)  print $0}' /etc/passwd



after all changes update these changes and reset the boot parameters, use the following command

touch /.autorelabel


exit and reboot the machine

Login using new password....