create a public key from amazon ssh key pair

When you create a new key pair in Amazon Webs Services (AWS) you only have the RSA private key in a .pem file.

To create a public key use this command

ssh-keygen -y -f <yourprivatekey.pem> > yourpublickey.pub

This will create the file yourpublickey.pub containing the public key in your current folder.

AWStats cronjob not working

I had a strange problem on Ubuntu 10.04, the AWStats cronjob was not working even though everthing worked fine on the command line as root. The solution was to add /usr/bin/perl in front of /usr/lib/cgi-bin/awstats.pl. So here is the working cronjob, hope it helps.

*/10 * * * * /usr/bin/perl /usr/lib/cgi-bin/awstats.pl --config=www.example.com -update

(replace www.example.com with the part of the configuration file name, here it would be awstats.www.example.com.conf)

 

connect to cisco vpn in debian

The default Debian setup only shows options to connect to OpenVPN and to Import from file. To connect to a Cisco VPN first install these packages:

vpnc network-manager-vpnc  network-manager-vpnc-gnome

After a restart of Network Manager (/etc/init.d/network-manager restart) you will have an additional option, Cisco Compatible VPN (vpnc).

 

Compare SSL key and certificate

If you want to find out if a key and certificate match you can compare them like this:

openssl rsa -noout -modulus -in <name of key> | openssl md5
openssl x509 -noout -modulus -in <certificate name> | openssl md5

 

apt don’t upgrade specific package

Sometimes it can be handy not to upgrade certain packages during an apt-get upgrade, e.g. in a MySQL replication setup where MySQL requires special attention. To prevent a package from being upgraded, use the command

apt-mark hold packagename

In case of MySQL the full command could look like this:

sudo apt-mark hold mysql-client-core-5.5 mysql-client-5.5 mysql-server-core-5.5 mysql-server-5.5 mysql-client mysql-server mysql-common

Simulate with

apt-get -s upgrade

what will happen during the update and add other packages as needed to the hold list. To remove a list from the hold use

sudo apt-mark unhold packagename

You can also use the apt-mark hold command to prevent a package from being installed.