########################################################################################################################################################################################################################################################## Copiar todos los comandos
########################################################################################################################################################################################################################################################## Generar PDF seleccionado/button
■/div titulada
Comandos SSH completos para el acceso remoto seguro, el túnel y la administración del sistema en todas las plataformas.
# Global defaults
Host *
ServerAliveInterval 60
ServerAliveCountMax 3
TCPKeepAlive yes
# Specific host configuration
Host myserver
HostName server.example.com
User myusername
Port 2222
IdentityFile ~/.ssh/myserver_key
ForwardAgent yes
# Jump host configuration
Host target
HostName 192.168.1.100
User admin
ProxyJump jumphost
Host jumphost
HostName jump.example.com
User jumpuser
Opciones de configuración común
Option
Description
Example
HostName
Real hostname or IP
HostName server.example.com
User
Username for connection
User admin
Port
SSH port number
Port 2222
IdentityFile
Private key file
IdentityFile ~/.ssh/id_rsa
ForwardAgent
Enable agent forwarding
ForwardAgent yes
Compression
Enable compression
Compression yes
Port Forwarding and Tunneling
Local Port Forwarding
# Forward local port to remote service
ssh -L 8080:localhost:80 user@hostname
# Forward to different remote host
ssh -L 3306:database.internal:3306 user@gateway
# Multiple port forwards
ssh -L 8080:localhost:80 -L 3306:localhost:3306 user@hostname
Puerto remoto hacia adelante
# Forward remote port to local service
ssh -R 8080:localhost:3000 user@hostname
# Allow remote connections to forwarded port
ssh -R 0.0.0.0:8080:localhost:3000 user@hostname
Avance dinámico del puerto (SOCKS Proxy)
# Create SOCKS proxy on local port 1080
ssh -D 1080 user@hostname
# Use with applications
# Configure browser to use SOCKS proxy: localhost:1080
# Generate user certificate
ssh-keygen -s ca_key -I user_id -n username user_key.pub
# Use certificate for authentication
ssh -o CertificateFile=user_key-cert.pub user@hostname
Solución de problemas
Cuestiones de conexión
# Debug connection problems
ssh -vvv user@hostname
# Test specific authentication method
ssh -o PreferredAuthentications=publickey user@hostname
# Check SSH service status
systemctl status ssh # Linux
service ssh status # Linux (older)