Install and configure RKHunter on Linux
Install
To install rkhunter run:
sudo apt-get install rkhunter
Choose no mail server when prompted.
Configure
- Check for database updates with:
sudo rkhunter --update
- Run a full scan with:
sudo rkhunter -c
- Add the following to the rkhunter.conf file to ignore known issues:
- ALLOWDEVFILE=“/dev/.udev/rules.d/root.rules”
- ALLOWHIDDENDIR=“/dev/.udev”
- ALLOWHIDDENFILE=“/dev/.blkid.tab”
- ALLOWHIDDENFILE=“/dev/.blkid.tab.old”
- ALLOWHIDDENFILE=“/dev/.initramfs”
- SCRIPTWHITELIST=“/usr/bin/unhide.rb”
- Check the RKHunter configuration updates just made with:
sudo rkhunter -C
- Remove ssh configuration issues by disabling root login and password login by editing /etc/ssh/sshd_config and updating the following:
- PermitRootLogin no
- PasswordAuthentication
- Run a full scan to ensure there are no other errors:
sudo rkhunter -c
- Once there are no errors, update the RKHunter data file:
sudo rkhunter --propupd
Maintain
If your system is infected with rootkits or if you install any new packages you could get RKHunter errors. You can fix them as follows:
- Rescan the system
sudo rkhunter -c
- Fix any errors
- Update the data file
sudo rkhunter --propupd
Other useful commands
- To check for a new version:
sudo rkhunter --versioncheck
- To run without manual intervention, remove colour codes and only output warnings:
sudo rkhunter --cronjob --rwo
Additional Dependencies
- Install Unhide to find hidden processes and ports:
sudo apt-get install unhide
Tripwire - It is recommended that Tripwire be installed as a standalone package and not run through RKHUnter.