deleted /dev partition linux

Hello,

If you have accidentally deleted /dev partition then you will face issues in ssh for sure, so you may try the following fixes via console so that ssh may start.

Try restarting sshd

/etc/init.d/sshd restart 

if you receive the following output

/dev/null no such file or directory

then

cd /dev
ls -al null
O/P

ls: cannot access null: No such file or directory
then you need to create one.

mknod /dev/null c 1 3
chmod 666 /dev/null
/etc/init.d/sshd restart

O/P

PRNG is not seeded

means your urandom file not present now, you need to create it

ls -al /dev/urandom
ls: cannot access /dev/urandom: No such file or directory
mknod /dev/urandom c 1 9

now restart sshd.

/etc/init.d/sshd restart

O/p

Stopping sshd:               [  OK  ]
Starting sshd:               [  OK  ]

Cool, your sshd is now restarted, however when you login via ssh you may receive the following error and cannot access the server’s commandline.

login as: root
root@xx.xx.xx.xx's password:
Server refused to allocate pty

So, now you need to create pty and tty by the following command.

/sbin/MAKEDEV pty
/sbin/MAKEDEV tty

now you will be able to access server via ssh. 🙂

Reference:

Leave a Reply

Protected by WP Anti Spam