Log all commands run by admins on production servers

Update: 2 more things that have popped up in the comments and in follow-up questions: Using auditd this way will dramatically increase your log volume, especially if the system is heavily in use via commandline. Adjust your log retention policy. Auditd logs on the host where they are created are just as secure as other … Read more

My /var/log/btmp file is huge! What should I do?

This means people are trying to brute-force your passwords (common on any public-facing server). It shouldn’t cause any harm to clear out this file. One way to reduce this is to change the port for SSH from 22 to something arbitrary. For some additional security, DenyHosts can block login attempts after a certain number of … Read more

Adding a directory to $PATH in CentOS?

It’s not a good idea to edit /etc/profile for things like this, because you’ll lose all your changes whenever CentOS publishes an update for this file. This is exactly what /etc/profile.d is for: echo ‘pathmunge /usr/lib/ruby-enterprise/bin’ > /etc/profile.d/ree.sh chmod +x /etc/profile.d/ree.sh Log back in and enjoy your (safely) updated $PATH: echo $PATH /usr/lib/ruby-enterprise/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin which ruby … Read more

Best way to gracefully restart CentOS?

Systems using systemd (CentOS >=7) will have the reboot, shutdown and halt commands symlinked to systemctl to handle the reboot. The systemctl program will detect the use of the symlink and run the systemctl command with the correstponing arguments. For the difference between the commands see the manpage for systemctl (man systemctl) for it is … Read more