
Я просто неправильно настроил свой, /etc/passwd
использовал эту команду при входе в систему как root
root@ubuntu:~# sh -c 'echo "nope no entry mates" > /etc/passwd'
Теперь всякий раз, когда я пытаюсь получить доступ к своему VPS через любого пользователя или учетную запись root, я получаю
ssh root@myVpsIp
kex_exchange_identification: read: Connection reset
Отладка SSH
C:\Users\tommy>ssh root@myVpsIp -v
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug1: Connecting to myVpsIp [myVpsIp] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\tommy/.ssh/id_rsa type -1
debug1: identity file C:\\Users\\tommy/.ssh/id_rsa-cert type -1
debug1: identity file C:\\Users\\tommy/.ssh/id_dsa type -1
debug1: identity file C:\\Users\\tommy/.ssh/id_dsa-cert type -1
debug1: identity file C:\\Users\\tommy/.ssh/id_ecdsa type -1
debug1: identity file C:\\Users\\tommy/.ssh/id_ecdsa-cert type -1
debug1: identity file C:\\Users\\tommy/.ssh/id_ed25519 type -1
debug1: identity file C:\\Users\\tommy/.ssh/id_ed25519-cert type -1
debug1: identity file C:\\Users\\tommy/.ssh/id_xmss type -1
debug1: identity file C:\\Users\\tommy/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
kex_exchange_identification: Connection closed by remote host
Все еще есть окно root ssh, в котором я пытался найти решение проблемы и добрался до нее.
root@ubuntu:~# cut -d : -f 1 /etc/passwd
nope no entry mates
Кто-нибудь знает, как восстановить мой /etc/passwd
?
решение1
Проверьте, есть ли у вас резервная копия /etc/passwd, расположенная в /var/backups/passwd.bak, и если вы запустили cp /var/backups/passwd.bak /etc/passwd
, то выполнитеchmod 644 /etc/passwd
Если у вас нет /var/backups/passwd.bak, вы можете использовать /etc/passwd-
Похоже, вы удалили весь файл /etc/passwd первой же выполненной командой.