Thursday, December 19, 2013

Reset A Forgotten Root Password (CentOS)

I have done something that I thought that I would never have done. I forgot the root password on a CentOS server/workstation.

I don't know if I just had my hands on the wrong keys where I was typing the password or what but I forgot it.

Luckily, there is a way to reset this lost password.

First, you will need console access to the server, meaning, you will need to be physically sitting or standing in front of the server and have physical access to it. SSH remote access will not work.

Next, reboot the server/workstation.

Now, once it is starting to boot backup, you need to interrupt the boot at the GRUB stage (The first count down after you push the power button) by pressing a key like the space bar.

Next, press the "a" key, this will bring you to a command line with a command pre-typed for you. On the line that is there, remove (backspace) the "rhgb quiet" and add a "1" and then press enter.

This will boot into the root shell and NOT a login prompt. This is a single user mode.

From here you can enter the passwd command and reset the password. You can also reset other users passwords and do other administrative tasks.

Once you are done, reboot the server and let it boot normally.

*Note: If you are using CentOS 6 and have SELinux enabled, you will need to do either 1 of 2 things; add "selinux=0" in addition to the "1" from above or issue a "setenforce 0" command after you login and before resetting the password.

Original Source:

How To Setup DRBL (Diskless Remote Boot in Linux) On CentOS 6

I know it has been a while since my last post. Since my last post I have changed jobs from a public K-12 education environment to a private manufacturing environment and this has caused me to refocus my time and efforts on to other things. The job change has also given the time to research and implement some of those back burner projects that I just never had the time for.

One of those back burner projects that I have been wanting to get to for a long time is thin client computing. I have been messing around with the idea of thin clients for almost the last 10 years.

During this time, I understood the big picture of how thin client computing works. A client boots from a CD/DVD/Network/USB/whatever and gets a GUI terminal from the server. The client terminal sends commands to the server, the server processes those commands and sends back an updated GUI screen.

This is a great idea when you have a large number of computers that all need the same software and/or requires little change. Thin clients can save a lot of time. An example I can give is a computer lab of 30+ computers in an elementary or middle school.

Can you imagine the amount of time it would take to install a program like Microsoft Office on 30+ computers? Of course there are faster way to do this but stay with me here for a minute. Lets say that Microsoft Office, from a disc, on 30 computers in a lab. Each install in 20 minutes. Since you only have one disc, you have to do the install one computer at a time. At 20 minutes each, it would take you over 10 hours to complete this. Not my idea of fun.

Now in a thin computing environment, all you would have to do is one 20 minute install and possibly a reboot of the thin client computers.

Alright, enough with me jabbering and on to what you are wanting. The How-To

I chose to go with DRBL because it has been the easiest to setup out of all the other ones that I have seen by far.

My Equipment:
Server (Virtual)
     - Dual processors
     - 1GB memory
     - 10GB hard drive
     - 2 network adapters that function at gigabit speed.
          - NIC #1: IP Address Subnet/netmask: Gateway:
          - NIC #2: IP Address Subnet/netmask: No Gateway

Thin Client (Dell Dimension 4700)
     - I removed the hard drive
     - 512MB memory

  1. Install the server operating system. During the install, make sure you set the IP addresses for your NIC cards. I used CentOS 6 with the GUI. I have explained this before so I am not going to bore you with that.
    *Note: The developer's install instructions suggest that you have at least to network cards installed in the server. You can do this setup with one and create subinterfaces but you might sacrifice performance in the long run when you start to add more clients. 
  2.  Update all the system software with a "yum update -y" and disable SELinux (edit /etc/selinux/config) and reboot.
  3. Turn off and disable NetworkManager. To do this, open a terminal window and type "service NetworkManager stop" to turn off and "chkconfig NetworkManager off" to keep it from starting up when the server is booted. 
  4. Now we need to install some keys for DRBL. In the terminal window, type "rm -f GPG-KEY-DRBL; wget; rpm --import GPG-KEY-DRBL" then type"gpg --keyserver --recv-key D7E8DF3A" and then finally type "gpg -a --export D7E8DF3A > GPG-KEY-DRBL; rpm --import GPG-KEY-DRBL".
  5. Download the DRBL RPM file. You can find the most current stable version here. I downloaded version 2.6.15 (filename: drbl-2.6.15-drbl1.noarch.rpm)
  6. Install the DRBL RPM file. Since the DRBL RPM requires a Perl module, it is easier to use yum instead of rpm because it will automatically download and install the needed modules. Type: "yum install drbl-2.6.15-drbl1.noarch.rpm".
  7. For this next step, there are two scenarios. Since there is a broadband connection, I went with the first one. Type "drblsrv -i" and follow the on screen prompts. *Note: There is a space before the "-i".
  8. Now we are ready to do the setup for the thin clients. Before you run the "drblpush -i" command, I suggest you read this. It provides a lot of information that is useful but is outside of the scope of this post.
  9. If you have not done so already, run the "drblpush -i" command and answer the questions in the guide. I pretty much stuck with the default choices with the exception of Clonezilla. I chose not to use it.
  10. Once "drblpush -i" command has completed, you are ready to prepare the client computers.
         - I disconnected and removed the hard drive from the client machine, you don't have to
         - In BIOS, set the network card to enable PXE and set it as the first boot option.
         - Save and exit.
  11. Boot the client. Log in and enjoy the fruits of your labor.

Original Source: