Monday, December 3

Activate NIC or network card at boot time for Redhat/CentOS


In recent RHEL6/CentOS6 NIC is not getting up by default. So once you login we have to up the network interface to make it work properly. To make the interface available at the time of boot we have to set ONBOOT option in ifcfg-eth0 file.
Open the file In file /etc/sysconfig/network-scripts/devices/ifcfg-eth0 and change ONBOOT value to yes
Before editing the file.
DEVICE=eth0
HWADDR=52:54:00:60:af:6d
NM_CONTROLLED=yes
ONBOOT=no
BOOTPROTO=dhcp
TYPE=Ethernet
USERCTL=no
PEERDNS=yes
IPV6INIT=no
After editing the file
DEVICE=eth0
HWADDR=52:54:00:60:af:6d
NM_CONTROLLED=yes
ONBOOT=yes
BOOTPROTO=dhcp
TYPE=Ethernet
USERCTL=no
PEERDNS=yes
IPV6INIT=no
Reboot the machine and your NIC interface will be activated at the time of booting.

How to unlock an user account in Linux?


How to unlock a user account in Linux?

Some times on Linux boxes the user account will be locked due to issues such as wrong password entry, account expiry etc. In this post we will see how to unlock user account with different commands.
Example1: Check if the password is disabled by viewing /etc/shadow file for user entry.
grep ‘username’ /etc/shadow
if you are able to see ! in the second field starting that indicates that password is disabled, you have to enable it back by using passwd with -u option
passwd -u username
Example:
passwd -u ram
Unlocking password for user temp.
passwd: Success

How to delete user account in Linux?


How to delete user account in Redhat/Ubuntu Linux?

Deleting user account in Linux is as a task to remove user login credentials from system configuration files such as /etc/passwd, /etc/shadow and files which are owned by that particular user  from the Linux server. Here we are going to see on how to delete a user and precautions to be taken when deleting users. Lets start deleting user with examples.

What is lost+found directory in Linux/Unix?

This is an important directory which is useful for recovering files which are not properly closed due to many reason such as power failure. Lost+Found is created by system at the time of Linux OS installation for each partition we create. In other words we can say the mounted folder contains this lost+found folder. This folder contains the files with no links and files to be recovered. Any file to be recovered is kept in this folder. fsck command is used to recover these files.

Lost the Root password


Lost the Root password
When you lost root password how you can recover and login back in to the system?
To login in to system there are so many ways to get root access depending on security level of the system.
Method1: When there is no password set to access runlevel 1.
Here are the steps to change your root password the most esiest way is as follows..
1. Start your computer when you see Redhat Linux boot loader(GRUB menu where you can see all the Operating system’s in the system) select the redhat linux and press “e”, and select second line where you can set the temporary runlevel for the system to boot
2. You will notice that now you can edit boot loader command arguments now again press “e” and edit the line to add single or 1 without quots at the end of line.
3. Press enter to return to previous screen
4. Press b to boot with this new argument which will run Linux into single user mode. Please make sure that you see single at the end of line.
5. Now you will get root login with out asking for a password in single user mode.
6. Use “passwd” command to change your password.
#passwd
here it will not ask previous password so you can just enter new password.
7. When updateing the password in runlevel1 if the server is not allowing you to change password giving you error, this is due to /etc/shadow file issue.
In order to resolve this issue execute the following command and then try to change the password
#pwunconv
7.After changing the password just type exit command which will take you to default runlevel of the system or just Reboot and use the new password.