Posts Tagged ‘Linux’

Pear – install alpha packages

Pear probably won’t let you install any alpha package by default (such as HTTP_Request2). Do this to install it quickly: pear config-set preferred_state alpha pear install HTTP_Request2 pear config-set preferred_state stable

Configuring TFTP on Centos to backup Cisco ASA / IOS

Setting up TFTP on CentOS is actually very trivial (excuse the pun)! I find it useful for backing up config from network devices such as my Cisco ASA. Install tftp: yum install tftp-server chkconfig tftp on service xinetd restart

Increasing Partition Size on a VMWare Linux Virtual Machine

Naively, when creating my new VMWare ESXi virtual machines, I was expecting to be able to resize the disks with a one-liner as I have done in the past with container based virtualisation. Unfortunately it’s not quite that simple, the VM partitions will need manually resizing: Increase the virtual disk size via Vsphere to the […]

Check how old a Linux password is using chage

I came across a command today that I’ve never really had a use for before.  chage can be used to check when a password was last modified and also shows any password expiration rules etc.  It can also be used to implement password expiration. A very useful tool if password policies are required, although PAM […]

Delete a file older than X days using mtime

List files older than 5 days: find ./ -mtime +5 To count all files older than 5 days find ./ -mtime +5 |wc -l To move files to an archive directory: find ./ -mtime +5 -exec mv {} /var/archive \; -print To delete the files find ./ -mtime +5 -exec rm {} \; -print

Prevent brute force attacks using SSHBlack

SSHBlack is a very useful script which monitors the system logs for repeated failed logins and then blocks the source IP.  This can pretty much negate basic brute force attacks.  There are plenty of similar other applications such as BruteLock, but I think SSHBlack works well.  The following is a very handy article which shows […]

NTP Configuration on RedHat

Make sure its installed and enabled: yum install ntp chkconfig ntpd on /etc/init.d/ntpd start Config can be done in /etc/ntp.conf such adding local time servers: server mytimeserver.com You can instantly update the time from the timeserver by running: ntpdate pool.ntp.org or ntpd -qg If you get an error like: 5 Mar 14:09:24 ntpdate[19228]: the NTP […]

Postfix queue administration

Although I’ve used many MTA’s before, I’m new to postfix so here’s a few handy commands to note: List the mail queue: postqueue -p or mailq Delete a single message: postsuper -d 4C63F2300BA

Find broken symlinks

Quick tip to find broken symlinks in the filesystem: find -L . -type l

Convert SSH2 keys to OpenSSH

Convert SSH2 key to OpenSSH format: ssh-keygen -i -f id_dsa_1024_a.pub > id_dsa_1024_a_openssh.pub Or to convert an OpenSSH key to SSH2: ssh-keygen -e -f id_dsa.pub > id_dsa_ssh2.pub