OpenVZ

OpenVZ Related Articles

SSH not starting/cannot login/PRNG not seeded

So from home, I was trying to sftp and got this:

gregg@gregg-desktop:/usr/share/fonts/truetype/freefont$ sftp -o port=6032 someuser@mochabomb.com
Connecting to 38.108.178.168...
ssh_exchange_identification: Connection closed by remote host
Couldn't read packet: Connection reset by peer

Ok, lets see if the server is happy..

root@vps [~]# service sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd: PRNG is not seeded
                                                           [FAILED]

.. that ain't good...

Some googling of the error - mind this is my VPS - OpenVZ based - here we go:
Random device missing

"I think the reason is that you had udev daemon in physical node. Thus you have to create necessary devices by yourself inside VE (`mknod /dev/random c 1 8`)."

So will create a script to do this for me - don't need to be locked out:

#!/bin/bash
if [ -z /dev/random ]; then
   mknod /dev/random c 1 8 
   ls -al /dev/random 1> /var/tmp/devrandom
   /sbin/service sshd restart 1> /var/tmp/devrandom
   mail root -s "Created /dev/random at `date` on `hostname`" < /var/tmp/devrandom
   rm /var/tmp/devrandom
fi

Then add to cron - longest I'll ever be locked out is 15 minutes...
0,15,30,45 * * * * /root/bin/make-dev-random.sh