When standard bash completion is not enough try installing bash-completion package from EPEL repository.
# yum install bash-completion
Now log off and on again or run:
# source /etc/bash_completion
You should get more logical hints, try this:
# ifup [TAB][TAB]
eth0 eth0:0 eth0.bak lo
See - it's now suggesting (and completing) interface names instead of files in the current directory. Cool stuff!
Friday, July 5, 2013
Adding EPEL repository
EPEL stands for Extra Packages for Enterprise Linux.
It contains a lot of cool packages that may make your life easier on CentOS or RHEL.
Just install epel-release package for appropriate system release (5 or 6):
# wget http://ftp.pbone.net/pub/fedora/epel/5/i386/epel-release-5-4.noarch.rpm
# rpm -ivh epel-release-5-4.noarch.rpm
Thursday, July 4, 2013
Howto to add date and time to bash history
It might be useful to to log time stamp to each bash command that is being executed on server you maintain (even more if you're not the only admin there).
To keep everyone's history with time stamps edit /etc/bashrc and add:
export HISTTIMEFORMAT="%y/%m/%d %T "
for one user only edit ~./bash_profile file and add the same line.
The fields that you may use means:
%y - year
%m - month
%d - day
%T - time
%H - hour
%M - minute
%S - second
To keep everyone's history with time stamps edit /etc/bashrc and add:
export HISTTIMEFORMAT="%y/%m/%d %T "
for one user only edit ~./bash_profile file and add the same line.
The fields that you may use means:
%y - year
%m - month
%d - day
%T - time
%H - hour
%M - minute
%S - second
Intrusion detection tools on Linux - AIDE
AIDE is an opensource file integrity check tool. It can help you verifying files integrity in an easy way.
1. Install AIDE package on CentOS/RHEL:
# yum install -y aide
2. Check and adjust aide configuration file to fulfill your needs:
# vim /etc/aide.conf
3. Initialize AIDE database - it will scan all the files in folders that were included in the config file and save their hash as well as attributes info
4. You may consider keeping golden copy of AIDE database (default is set to /var/lib/aide/aide.db.gz) is secure and read-only location. It will allow you to compare current system integrity to the golden copy.
To check what changed run:
# aide -C
If you get "Couldn't open file /var/lib/aide/aide.db.gz for reading" error it means you need to move database generated in step 3 to this location:
# mv /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz
Subscribe to:
Posts (Atom)