I had a number of 12.10 machines running on EC2 and provisioned them using scripts built around:
- ssh
- scp
- rsync
Now I have replaced most of my 12.10 machines with 14.04 machine and am finding that my provisioning scripts now run prohibitively slowly whilst executing the same remote commands.
An example of a remote command being used is:
ssh -o StrictHostKeyChecking=no -o BatchMode=yes -p22 -i /Users/.ssh/ec2_key.pem [email protected] "sudo /etc/init.d/redis-server status"
This will execute very quickly on my 12.10 machines, maximum 3 seconds delay, however the same command on the 14.04 machines can take upwards of 60 seconds.
Does anyone know what the problem is?
Watching the machine through htop whilst running a remote command indicates that the problem is somehow related to the message of the day:
Um, I think you'll find that your server is triggering a message of the day update upon an established ssh connection.
You can run the scripts in /etc/update-motd.d and see which is running slowly and deal with the slow script however you wish.
Or you can disable this automatic updating by commenting out the following lines in the /etc/pam.d/sshd file