![No puedo acceder a mi VPS a través de SSH](https://rvso.com/image/1070933/No%20puedo%20acceder%20a%20mi%20VPS%20a%20trav%C3%A9s%20de%20SSH.png)
Simplemente configuré mal mi /etc/passwd
comando y lo usé al iniciar sesión como root.
root@ubuntu:~# sh -c 'echo "nope no entry mates" > /etc/passwd'
Ahora, cada vez que intento acceder a mi VPS a través de cualquier usuario o cuenta raíz, aparece
ssh root@myVpsIp
kex_exchange_identification: read: Connection reset
Depuración 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
Todavía hay una ventana ssh de raíz registrada en la que intenté encontrar la solución al problema y llegué al problema.
root@ubuntu:~# cut -d : -f 1 /etc/passwd
nope no entry mates
¿Alguien sabe cómo restaurar mi /etc/passwd
?
Respuesta1
Vea si tiene una copia de seguridad de /etc/passwd ubicada en /var/backups/passwd.bak y si la ejecutó cp /var/backups/passwd.bak /etc/passwd
y luego ejecutóchmod 644 /etc/passwd
Si no tiene /var/backups/passwd.bak, puede usar /etc/passwd-
Parece que ha eliminado todo su archivo /etc/passwd con el primer comando que ejecutó.