Si queremos conectarnos a una máquina Kali a través de ssh desde otro ordenador, podemos hacer lo siguiente:
Instalamos openssh-server:
# apt install openssh-server
Iniciamos el servicio y lo hacemos persistente:
# systemctl start ssh
# systemctl enable ssh
También podriamos lanzar el siguiente comando para activar el servicio cada vez que arranca:
# update-rc.d -f ssh enable 2 3 4 5
Cambiamos la keys por defecto, son genéricas y un atacante podría llegar a acceder por esta razón:
# cd /etc/ssh
# mkdir keys_originales
# mv ssh_host_* keys_originales
Creamos unas nuevas keys:
# dpkg-reconfigure openssh-server
Si no es capaz de reiniciar el servicio, lo reiniciamos:
# systemctl restart ssh
Para poder acceder como root a través de otra máquina, podemos editar el archivos de configuración:
# vim /etc/ssh/ssh_config
Y cambiamos la línea:
PermitRootLogin without-password
Por:
PermitRootLogin yes
Lo ideal es que no usemos root para conectarnos y lo hagamos con otro usuario administrador.
Reiniciamos el servicio y listo:
# systemctl restart ssh
Si hemos estado trasteando intentando conectarnos, es muy posible que nuestro cliente ssh nos diga algo así:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:haT1L2EXIOd/F4UvYeAbr+HFnuPgCaK8dajK77R9m8I.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /root/.ssh/known_hosts:3
remove with:
ssh-keygen -f "/root/.ssh/known_hosts" -R "192.168.1.203"
ECDSA host key for 192.168.1.203 has changed and you have requested strict checking.
Host key verification failed.
---------------------------------------------------------------------
Es tan sencillo como lanzar el comando para la ip que identifica la máquina linux:
# ssh-keygen -f "/root/.ssh/known_hosts" -R "192.168.x.x"
Una vez que se regenere el fingerprint, ya podremos conectarnos.
SaluDOS.
No hay comentarios:
Publicar un comentario