The iptables utility controls the network packet filtering code in the Linux kernel. The iptables feature is used to set up, maintain, and inspect the tables of IP packet filter rules in the Linux kernel. Several different tables may be defined. Each table contains a number of built-in chains and may also contain user-defined chains. On the FTP Server, by default iptables rules are not set to allow port 20/21 for FTP connection. Trying to open a ftp connection results in the following … [Read more...] about CentOS / RHEL : How to configure iptable rules to allow FTP ports 20/21
Archives for May 2017
Basic vi commands (cheat sheet)
vi is one of the most commonly used editor program and included by default with every UNIX and linux system. vi basically operates in 3 modes, namely : vi mode - the mode vi starts in command mode - you can be in command mode from the vi mode by pressing the key colon (":") input mode - in this mode user starts the actual editing of the text Below are some of the most commonly used vi commands in all 3 modes of operation. vi mode commands CommandAction kMove one line upwards … [Read more...] about Basic vi commands (cheat sheet)
Change default kernel (boot with old kernel) in CentOS/RHEL/OEL 5 and 6
The following post shows the procedure to boot CentOS/RHEL/OEL 5 and 6 systems into different kernel installed. CentOS/RHEL/OEL 5 and 6 operating system uses GRUB as the default boot loader. When you install a kernel using either rpm, up2date or yum application, the kernel package creates an entry in the boot loader configuration file for that new kernel. However, rpm does not configure the new kernel to boot as the default kernel, up2date and yum does. You must do this manually when … [Read more...] about Change default kernel (boot with old kernel) in CentOS/RHEL/OEL 5 and 6
CentOS / RHEL 7 : How to boot into emergency or multi-user mode from GRUB2
Prior to RHEL 7, runlevels were used to identify a set of services that would start or stop when that runlevel was requested. Instead of runlevels, systemd uses the concept of targets to group together sets of services that are started or stopped. A target can also include other targets (for example, the multi-user target includes an nfs target). The post below describes steps to boot an RHEL 7 system into emergency or multi-user mode directly from the GRUB. 1. When the server is booting … [Read more...] about CentOS / RHEL 7 : How to boot into emergency or multi-user mode from GRUB2
CentOS / RHEL 7 : How to add a kernel parameter only to a specific kernel
When we add a parameter to /etc/sysconfig/grub and run grub2-mkconfig -o /boot/grub2/grub.cfg, the parameter will be added to all of the kernel entries. This is the default behaviour of a RHEL 7 system. How can we add kernel parameter to a specific kernel version when there are more than one kernel in the system in RHEL7 / CentOS 7. How to modify a specific kernel only 1. Copy the desired menuentry from /boot/grub2/grub.cfg to /etc/grub.d/40_custom. The entry begins with the line starting … [Read more...] about CentOS / RHEL 7 : How to add a kernel parameter only to a specific kernel
What’s the difference between locate and find command in Linux
Two popular commands for locating files on Linux are find and locate. Depending on the size of your file system and the depth of your search, the find command can sometime take a long time to scan all of the data. For example, if you search your entire filesystem for the files named data.txt: # find / -name data.txt More likely than not, this will take on the order of minutes, if not longer to return. A quicker method is to use the locate command: # locate data.txt However, this … [Read more...] about What’s the difference between locate and find command in Linux
Change default kernel (boot with old kernel) – CentOS/RHEL/OEL 7
Question: How to modify the GRUB2 default entry to boot a different Kernel version? 1. Check the current running Kernel Version # uname -a Linux geeklab 3.8.13-94.el7uek.x86_64 #2 SMP Wed Feb 11 14:18:22 PST 2015 x86_64 x86_64 x86_64 GNU/Linux 2. List the Kernel Entries as per GRUB2 file: # awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg Oracle Linux Server, with Unbreakable Enterprise Kernel 3.8.13-94.el7uek.x86_64 Oracle Linux Server, with Unbreakable Enterprise Kernel … [Read more...] about Change default kernel (boot with old kernel) – CentOS/RHEL/OEL 7
How to use sudo to allow a non-root user run a particular command
With the help of sudo, you can give access to a non-root user to run a root only command. Here is a short howto to provide the non-root user the access to a root only command. The command access that we will give to a user named "john" will be "/sbin/poweroff". Giving sudo access to a command 1. open the /etc/sudoers file. It is recommende to open this file using the visudo command. # visudo 2. Add the following lines at the end. (though can be added anywhere in the file) User_Alias … [Read more...] about How to use sudo to allow a non-root user run a particular command
CentOS / RHEL 7 : How to rename the volume group for root and swap
The requirement Here's the current setup - The root and swap volume reside on the volume group named vg_os. # vgs VG #PV #LV #SN Attr VSize VFree vg_os 1 2 0 wz--n- 557.88g 1.88g # lvs vg_os LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert lv_root vg_os -wi-ao---- 300.00g lv_swap vg_os -wi-ao---- 256.00g We need to change the name of VG from vg_os to root_vg. Below … [Read more...] about CentOS / RHEL 7 : How to rename the volume group for root and swap
CentOS / RHEL 6,7 : How to use yum history to roll back a yum update
Note : Rollback of selinux, selinux-policy-*, kernel, glibc (dependencies of glibc such as gcc) packages to older version is not supported. Thus, downgrading a system to minor version (ex: RHEL6.6 to RHEL6.5) is not recommended as this might leave the system in undesired state. Use the yum history option for small update rollbacks. How yum stores the transaction history yum stores a sqlite database of information about each transaction. The history is organized terms of transaction ids and … [Read more...] about CentOS / RHEL 6,7 : How to use yum history to roll back a yum update