Posts

Showing posts from 2016

Passwordless root SSH Public Key Authentication on RHEL

To set it up is relatively straight forward: On the client machine (ie. the one you are SSH'ing from) you will need to create an SSH RSA key. So run the following command - ensure you don't supply a password: [root@node01 ~]# ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Created directory '/root/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: c6:66:93:16:73:0b:bf:46:46:28:7d:a5:38:a3:4d:6d root@node01 The key's randomart image is: +--[ RSA 2048]----+ |            .    | |       . + o     | |      . @ E      | |       * & .     | |      . S =      | |       = + .     | |          o      | |         .       | |                 | +-----------------+ This will generate the following files: [root@node01 ~]# cd ~/.ssh [root@node

Enable KDUMP on RHEL server

How to enable kdump on RHEL Server Pre-requisites : For dumping cores to a network target, access to a server over NFS or ssh is required Whether dumping locally or to a network target, a device or directory with enough free disk space is needed to hold the core. For configuring kdump on a system running a Xen kernel, it is required to have a regular kernel of the same version as the running Xen kernel installed on the system. (If the system is 32-bit with more than 4GB of RAM, kernel-pae should be installed alongside kernel-xen instead of kernel.) Note: The kernel need only be installed. You can continue running the Xen kernel, and no reboot is required. Installation : 1) Install the kexec-tools    yum install kexec-tools 2) Need to add boot parameters : The option crashkernel must be added to the kernel command line parameters in order to reserve memory for the kdump kernel: The following is an example of /boot/grub/grub.conf with the kdump options added for RHEL 5: # grub.conf gene

Password Banner while changing the password in Linux

One of the solutions is to create a file /etc/motd_passwd_warning with your warning. Here “Your Password Minimum Requirements”. [root@localhost ~]# cat /etc/motd_passwd_warning Your Password Minimum Requirements Then to change the /etc/pam.d/passwd in adding the following line : password optional pam_echo.so file=/etc/motd_passwd_warning [root@localhost ~]# cat /etc/pam.d/passwd #%PAM-1.0 auth include system-auth account include system-auth password optional pam_echo.so file=/etc/motd_passwd_warning password substack system-auth -password optional pam_gnome_keyring.so use_authtok password substack postlogin And that is all. Here is the result : [root@localhost ~]# passwd Changing password for user root. Your Password Minimum Requirements New password: BAD PASSWORD: it is based on a dictionary word Retype new password: passwd: all authentication tokens updated successfully Remember to leave a comment about this..

Steps to rectify the Corrupted MBR on RHEL 5 & 6

Restore MBR in Linux Boot into the Rescue mode. boot:linux rescue Select language, keyboard and skip finding the installation Make a temporary mount point /vxvm and mount the root partition on it. mkdir /vxvm mount -t ext3 /dev/sda1 /vxvm [ where /dev/sda1 is the root partition ] If the disk has a separate boot partition mount it on /vxvm/boot mount -t ext3 /dev/sda2 /vxvm/boot [where /dev/sda2 is the boot partition] Recreate the master boot record (MBR) on the root disk. For the GRUB boot loader : Check contents of /boot/grub/menu.lst or /boot/grub/grub.conf or /etc/grub.conf are correct Use the /vxvm/sbin/grub command to enter into the grub menu to recreate the MBR on the disk # /vxvm/sbin/grub grub> root (hd0,1) grub> setup (hd0) grub> quit

restore default system permissions on Red Hat, CentOs, Fedora accidentally used chmod 777 /

How to restore default system permissions on Red Hat, CentOs, Fedora I recently came across a system which had some directories set to 777(recursively), the sysadmin needed to install an application and changed all the permissions!!!! a mess, I didn't know where to start, but one of my colleagues pointed that rpm has a parameter called --setperms and --setugids. I created a one liner that does the job, it takes time but It works !!!!! 1) To reset uids and gids on files and directories : for u in $(rpm -qa); do rpm --setugids $u; done 2) To permissions on files and directories for p in $(rpm -qa); do rpm --setperms $p; done # ll /etc/ssh/ # chmod 600 /etc/ssh/ssh_host_rsa_key # chmod 600 /etc/ssh/ssh_host_dsa_key # service sshd restart