Я неправильно сконфигурировал мой / 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 Debug
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
В корневом окне ssh все еще есть авторизованное окно, в котором я пытался найти решение проблемы и перешел к проблеме
root@ubuntu:~# cut -d : -f 1 /etc/passwd
nope no entry mates
Кто-нибудь знаете, как восстановить мой / etc / passwd
?
Посмотрите, есть ли у вас резервная копия / 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 с помощью первой запущенной команды.