SSH/es

SSH (Secure SHell) es un programa de terminal cifrado que reemplaza la herramienta clásica telnet sobre sistema operativo tipo Unix.

Además del acceso a la terminal remota proporcionada por el binario principal ssh, la suite de programas SSH ha crecido hasta incluir otras herramientas como scp (secure copy) y sftp (secure file transfer protocol).

Originalmente, SSH no era libre. Sin embargo, hoy la implementación estándar más popular y de-facto de SSH es OpenSSH de OpenBSD ,que viene pre-instalado en Gentoo.

Instalación
La mayoría de las implementaciones ya tendran instalado OpenSSH (a través del ). Este paquete utiliza las siguientes USE flags:

Después de cambiar los parámetros USE, no se olvide de recompilar OpenSSH:

Servidor
Añadir openssh al nivel de ejecución por defecto si no se ha hecho aun.

Iniciar el daemon sshd con:

El servidor OpenSSH puede ser controlado como cualquier otro servicio gestionado de OpenRC:

Crear Llaves
Con el fin de proporcionar un shell seguro, las Llaves criptográficas se usan para administrar las funcionalidades de cifrado, descifrado y de hashing ofrecidos por SSH.

En el primer inicio del servicio SSH, se generarán Llaves del sistema. Las Llaves pueden ser (re) generadas mediante el comando.

Para generar la clave utilizada para la versión 1 del protocolo SSH (que por lo general no está habilitado más, ya que ha dejado de utilizarse en favor de la versión 2 del protocolo):

To generate the keys for SSH protocol version 2 (DSA and RSA algorithms):

Server configuration
The SSH server is usually configured in the file, though it is also possible to perform further configuration in OpenRC's, including changing the location of the configuration file. For detailed information on how to configure the server see the sshd_config man page.

You should also study this guide for a security focused configuration.

Client configuration
The ssh client and related programs (scp, sftp, etc.) can be configured in following files:

For more information read the  manual:

Passwordless Authentication
Handy for git server management.

Client
On the client run the following command:

Server
Make sure an account for the user exists on the server, and then place the clients' file into the  file.

Single Machine Testing
The above procedure can be tested out locally:

Troubleshooting
There are 3 different levels of debug modes that can help troubleshooting issues. With -v ssh prints debugging messages about its progress. This is helpful in debugging connection, authentication, and configuration problems. Multiple -v options increase the verbosity. The maximum is 3.

Death of Long-lived Connections
Many internet access devices perform network address translation (NAT), a process that enables devices on a private network such as that typically found in a home or business place to access foreign networks, such as the internet, despite only having a single IP address on that network. Unfortunately, not all NAT devices are created equal, and some of them incorrectly close long-lived, occasional-use TCP connections such as those used by SSH. This is generally observable as a sudden inability to interact with the remote server, though the ssh client program has not exited.

In order to resolve the issue, OpenSSH clients and servers can be configured to send a 'keep alive', or invisible message aimed at maintaining and confirming the live status of the link.
 * To enable keep alive for all clients connecting to your local server, set ClientAliveInterval 30 (or some other value, in seconds) within the file.
 * To enable keep alive for all servers connected to by your local client, set ServerAliveInterval 30 (or some other value, in seconds) within the file.

X11 Forwarding Not Forwarding or Tunneling!
Problem: After you have made the necessary changes to the configuration files for permitting X11 Forwarding, you find X applications are executing on the server and are not being forwarded to the client.

Solution: What is likely occurring during SSH login into the remote server or host, the  variable is either being unset or is being set after the SSH session sets it.

Test for this scenario as follows after logging in remotely:

You should get something similar to "localhost:10.0" or "localhost2.local:10.0" using server side  setting. If you're getting the usual ":0.0", check to make sure you are not unsetting or initializing the  variable within. If so, remove or comment your custom initialization of  or prevent  from executing during SSH login:

A trick would be to alias this within.