Question: How can I tell which user ran a specific command ? or If the user clears their .bash_history can I still tell who ran a command? Answer: Using the process accounting tools, you can get basic information about who ran a specific command. Below are the steps to find out who run the command. […]
Archives for February 2017
CentOS / RHEL 7 : How to open a port in the firewall with firewall-cmd?
Question: How to open a port in RHEL 7 using the firewall-cmd command? Solution: To begin with check the firewalld status using the systemctl command : # systemctl status firewalld ● firewalld.service – firewalld – dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2016-10-29 21:47:04 IST; 1 weeks […]
CentOS / RHEL 6 : How to force a NTP sync with the NTP server(s)
This post briefly outlines how one can force a ntp (Network Time Protocol) sync with the ntp servers defined in the /etc/ntp.conf configuration file. This will not work if there are no ntp servers defined in the /etc/ntp.conf, this can be verified using : # grep ^server /etc/ntp.conf This document is useful when the date […]
CentOS / RHEL : How to disable BASH shell history
Question: How to disable BASH shell history, so that it does not save users shell history? Solution: Add a line like the following to the end of /etc/profile or a new /etc/profile.d/*.sh file unset HISTFILE This will make each user’s bash shell to skip saving history files unless the users manually configure the HISTFILE variable. […]
CentOS / RHEL : How to add a null route in Linux
As Per the ip man page, there are three route types which will drop traffic in specific ways: Route types: unreachable – these destinations are unreachable. Packets are discarded and the ICMP message host unreachable is generated. The local senders get an EHOSTUNREACH error. blackhole – these destinations are unreachable. Packets are discarded silently. The […]
How to configure Kdump on SuSE Linux Enterprise System 10 and 11
The post describes how to setup kdump on SuSE Linux Enterprise System (SLES) 10 and 11 to capture core dumps from Kernel panics and crashes. Kdump (kernel dump) provides a memory dump into a file named vmcore when the kernel has critical issue. Vmcore is often required to investigate the issue. The crash dump is […]
CentOS / RHEL : How to backup/restore configuration using authconfig
Steps 1. Backup the configuration files using authconfig utility. The general syntax for the command is : # authconfig –savebackup=[name] For example : # authconfig –savebackup=config_backup 2. Backup’s are saved at following location: # ll /var/lib/authconfig/backup-config_backup/ total 80 -rw-r–r– 1 root root 401 Oct 28 00:18 authconfig -rw-r–r– 1 root root 1 Oct 28 00:18 […]
CentOS / RHEL 7 : Never run the iptables service and FirewallD service at the same time!
By default, RHEL 7 uses the FirewallD service to provide network security. FirewallD must be stopped and disabled when using the iptables service: # systemctl stop firewalld.service # systemctl disable firewalld.service # systemctl enable iptables.service # systemctl start iptables.service The iptables service is now provided by a separate package called iptables-services: # yum info iptables-services […]
CentOS / RHEL 7 : Unable to start/enable iptables
Problem: When trying to start/enable the iptables daemon you receive the errors: # systemctl enable iptables Failed to issue method call: Access denied # systemctl start iptables Failed to start iptables.service: Unit iptables.service failed to load: No such file or directory. Solution: Starting with RHEL 7, firewalld is introduced and by default the iptables package […]
UNIX / Linux : Examples of bash history command to repeat last commands
One of the extensively used command in UNIX world is the history command. Every flavor of UNIX has the history command. The bash shell stores a history of commands entered, which can be used to repeat commands by using the history command. By default, it’ll show the previous 1000 commands that were used. Here’s a […]