You are on page 1of 6

15/9/21 11:42 [OpenWrt Wiki] Acceso SSH para recién llegados

Estás aquí /  /  Documentación /  Guía de inicio rápido para la instalación de OpenWrt


/  Acceso SSH para recién llegados

Acceso SSH para recién llegados


One of the methods to manage OpenWrt is using command-line interface over SSH
(https://en.wikipedia.org/wiki/SSH_(Secure_Shell)).
OpenWrt listens for incoming SSH ()
connections on port 22/tcp by default.
To “ssh into your router”, you can enter the following
command in a terminal emulator using you router's LAN () IP () address that is typically
192.168.1.1 :

ssh root@192.168.1.1

The first time you ssh into your router, you will probably see a warning about the RSA key
fingerprint.
If you are certain this is the address of your OpenWrt device, simply type yes
and press Return.
Then enter the password you have given to your router, or press Return if
this is the initial setup.
Here is an example session:

$ ssh root@192.168.1.1 <== You type


this

The authenticity of host '192.168.1.1 (192.168.1.1)' can't be established.

RSA key fingerprint is SHA256:4VbDA/MOc7inPiyllF5f0r3Q6iEx89ddKdhLGBovsiY.

Are you sure you want to continue connecting (yes/no)? yes <== and this

Warning: Permanently added '192.168.1.1' (RSA) to the list of known hosts.

root@192.168.1.1's password: <== and the p


assword here

BusyBox v1.28.4 () built-in shell (ash)

_______ ________ __

| |.-----.-----.-----.| | | |.----.| |_

| - || _ | -__| || | | || _|| _|

|_______|| __|_____|__|__||________||__| |____|

|__| W I R E L E S S F R E E D O M

-----------------------------------------------------

OpenWrt 18.06.2, r7676-cddd7b4c77

-----------------------------------------------------

root@OpenWrt:~# <== type next


command here

To end your ssh session to your router, type exit and press Return.

The remainder of this page describes several terminal emulators that Windows, Linux, or
macOS can use to access your OpenWrt device.

Windows terminal emulators

https://openwrt.org/docs/guide-quick-start/sshadministration 1/6
15/9/21 11:42 [OpenWrt Wiki] Acceso SSH para recién llegados

Windows Terminal for Windows 10 or the legacy ConHost (both giving access to Windows
PowerShell, Windows Command Prompt, WSL Bash), PuTTY, MinGW (installed together
with Git), Cmder, SmarTTY, and WinSCP are terminal emulators that allow you to SSH () into
an OpenWrt router.

Windows 10 built-in terminals


Both Windows PowerShell and Command Prompt allows using the default Windows 10 SSH
() client.
That SSH () client is an optional windows feature and has to be enabled
(https://docs.microsoft.com/en-us/windows-
server/administration/openssh/openssh_install_firstuse).

If you have installed a WSL distribution, the SSH () client is usually preinstalled in there.

If you directly launch cmd.exe , powershell.exe or wsl.exe the legacy ConHost terminal
will open.
Otherwise, you can install the modern Windows Terminal
(https://www.microsoft.com/store/productId/9N0DX20HK701) from the store and select any
of these shells from there.

1. Open any of the above terminal emulators and write ssh root@192.168.1.1 (“ssh” is
the command, “root” is the OpenWrt user you are connecting to, and “192.168.1.1” is
OpenWrt default IP ())
2. there will be a message about accepting a new key from the OpenWrt device, write
“yes” and press Enter key.
a. If for some reason you have reinstalled OpenWrt the device will have a different
key and you get an error about key mismatch. The error will state what is the
command line to copy-paste in your terminal to delete the old key and proceed.
Do it and retry.
3. if you want to close the session, write “exit”

The Windows 10 optional SSH () feature also includes SCP client (to
open/edit/download/upload files in OpenWrt via SSH ()).
Try google for some SCP tutorials
to learn how to use it.
Otherwise, use WinSCP which is way easier for SCP purposes.

PowerShell
Powershell (https://devblogs.microsoft.com/powershell/announcing-PowerShell-7-0/)
provides SSH () access.

Windows Subsystem for Linux (WSL)


The Windows Subsystem for Linux is a convenient way to run a Linux environment of your
choice including most,command-line tools, utilities, and applications directly on Windows.
For detailed steps of how to install WSL on Windows 10, refer to Microsoft's documentation:
https://docs.microsoft.com/en-us/windows/wsl/install-win10 (https://docs.microsoft.com/en-
us/windows/wsl/install-win10)

PuTTY

https://openwrt.org/docs/guide-quick-start/sshadministration 2/6
15/9/21 11:42 [OpenWrt Wiki] Acceso SSH para recién llegados

PuTTY gives you command-line access to OpenWrt.

1. Download PuTTY (https://www.putty.org/), get the 32bit putty.exe from the


Alternative binary files section.
2. Start putty.exe on your Windows client → PuTTY's login window pops up.
3. vaya a la Session categoría de la ventana de inicio de sesión de PuTTY, busque el
campo y simplemente ingrese la dirección IP () (por ejemplo, 192.168.1.1 ) de su
dispositivo OpenWrt, mantenga el puerto 22 predeterminado proporcionado . Host
Name (or IP () address) ()
4. Haga clic en el Open botón en la parte inferior para abrir una conexión. Aparecerá una
ventana de shell, solicitando login as . Inicie sesión como root con la contraseña
OpenWrt que ha definido algún tiempo antes. Si aún no ha establecido una
contraseña en "root", no se le pedirá la contraseña.
5. Hecho, ha iniciado sesión en la línea de comandos de OpenWrt.

Configuración de la autenticación basada en claves.

1. Genere un par de claves usando puttygen.exe . Guarde la clave privada en la PC y


agregue la clave pública /etc/dropbear/authorized_keys en su dispositivo OpenWrt.
2. Conexión → SSH () → Autenticación: En el cuadro "Parámetros de autenticación" en
"Archivo de clave privada para autenticación", indique la ruta a su archivo de clave
privada para esta conexión (por ejemplo, el openwrt.ppk archivo que creó antes). Lo
mejor es hacer clic en "Examinar ..." y seleccionar el archivo a través del cuadro de
diálogo de archivo.

Automatización de conexiones.

1. Conexión → Datos: En el cuadro "Detalles de inicio de sesión" ingrese el "Nombre de


usuario de inicio de sesión automático" que es root .
2. Cargue, guarde o elimine una sesión almacenada, ingrese openwrt.lan en Sesiones
guardadas y haga clic en el botón Guardar.
3. Para crear un acceso directo de PuTTY con un inicio de sesión automático, cree uno
y agregue la sesión guardada con un @ signo, por ejemplo, llame a PuTTY
con: putty.exe @openwrt.lan

WinSCP
WinSCP le permite navegar por el sistema de archivos OpenWrt en Windows Exlorer como
estilo GUI () .

1. Descargue WinSCP (https://winscp.net/eng/download.php) , obtenga el no beta


Installation package o portable executables e instálelos o descomprímalos en su
cliente de Windows
2. Comience WinSCP.exe en su cliente de Windows, aparecerá la ventana de inicio de
sesión de WinSCP
3. Haga clic en New Site a la izquierda, luego ingrese la dirección IP de () su dispositivo
OpenWrt (192.168.1.1) en el lado derecho en Host name , mantenga el puerto
predeterminado 22 . En User name enter root , en Password , ingrese su contraseña
de root (o déjela en blanco, si aún no ha establecido una contraseña)
4. Haga clic Login en en la parte inferior de la ventana.
5. Hecho. Ahora tiene una vista similar a la de un explorador de su sistema de archivos
OpenWrt.

https://openwrt.org/docs/guide-quick-start/sshadministration 3/6
15/9/21 11:42 [OpenWrt Wiki] Acceso SSH para recién llegados

Edición de archivos de configuración de OpenWrt con el editor de GUI () integrado de


WinSCP .

1. Para editar un archivo de configuración de OpenWrt con el editor basado en GUI () de


WinSCP , simplemente haga clic derecho en el archivo en WinSCP y seleccione
Edit en el menú contextual.

Cmder
Cmder para Windows es un emulador de terminal de código abierto que se ejecuta en
Windows. Es de uso gratuito y proporciona un sencillo "shell de línea de comandos" que le
permite ingresar a OpenWrt. Sus atractivas fuentes y su combinación de colores son
agradables a la vista. Se prefiere la distribución completa (sobre la mini distribución), ya que
proporciona una emulación bash, con un conjunto de comandos Unix-y.

1. Descarga Cmder (https://cmder.net/) .


2. Descomprima el archivo cmder.zip .
3. Abra la carpeta Cmder y haga doble clic en el icono Cmder. Verá una ventana de
Cmder abierta similar a la imagen de abajo.
4. Para ingresar al enrutador OpenWrt en 192.168.1.1, escriba y ssh
root@192.168.1.1 luego presione Retorno.

SmarTTY
SmarTTY le brinda acceso de línea de comandos a OpenWrt y le permite abrir / editar /
descargar / cargar archivos en OpenWrt, y en general es más moderno y fácil de usar que
PuTTY (otra herramienta que se detalla a continuación).

1. Descargue SmarTTY (http://sysprogs.com/SmarTTY/) , elija "descargar" para el


instalador o "versión portátil" si lo desea como un programa independiente que
funciona sin instalación.
2. después de la instalación o después de descomprimir el archivo, haga doble clic en
el archivo ejecutable SmarTTY .
3. Será recibido por una ventana con dos opciones, haga doble clic en "configurar una
nueva conexión SSH () " (la otra opción es para conexiones seriales, para dongles
usb- TTL () y algunos de los que se conectan a los pines seriales de depuración del
dispositivo en la placa, ganamos usar eso ahora).
4. La ventana cambia a la configuración SSH () , escriba la siguiente información:
a. Nombre de host: dirección IP del () dispositivo OpenWrt (el valor
predeterminado es 192.168.1.1 )
b. Nombre de usuario: root (este es el "administrador" y el único usuario en
OpenWrt predeterminado)
c. Contraseña: deje este espacio en blanco para su primera conexión, luego
escriba la contraseña que configuró (ya sea en la GUI de () Luci o después de
su primer acceso SSH () )
5. Haga clic en el botón "Conectar" en la parte inferior, y ahora verá una pantalla de
terminal grande que aparece
6. Un firmware OpenWrt predeterminado carece del componente de servidor que le
permite abrir / editar / ver / upoad / descargar archivos en SmarTTY, por lo que
después de conectarse a Internet, escriba opkg update && opkg install openssh-

https://openwrt.org/docs/guide-quick-start/sshadministration 4/6
15/9/21 11:42 [OpenWrt Wiki] Acceso SSH para recién llegados

sftp-server para instalarlo. Si el siguiente paso falla, podría ser necesario reiniciar el
dispositivo OpenWrt para que este nuevo servicio se inicie correctamente.
7. Ahora puede hacer clic en Archivo → Abrir un archivo remoto para abrir una
ventana emergente que muestra el sistema de archivos del dispositivo OpenWrt, y
puede navegar en él y abrir archivos de texto, por ejemplo, como de costumbre (se
abrirán en una ventana del editor de texto SmarTTY)
8. Si desea cargar o descargar archivos a / desde una carpeta específica en el
dispositivo, puede hacer clic en el menú SCP y elegir la acción más apropiada desde
allí.

Después de la primera vez que se conectó a un dispositivo, SmarTTY guardó un perfil, por
lo que puede conectarse nuevamente al mismo dispositivo (en esa dirección IP () con esa
contraseña) simplemente haciendo doble clic en su ícono en la primera ventana que ve al
iniciar SmarTTY. Puede hacer clic con el botón derecho en este icono de perfil para editarlo
de nuevo, si es necesario.

Emuladores de terminal de Linux


All Linux distributions provide a command-line ssh client as part of the default installation.

1. Open a terminal emulator and write ssh root@192.168.1.1 (“ssh” is the command,
“root” is the OpenWrt user you are connecting to, and “192.168.1.1” is OpenWrt
default IP ())
2. there will be a message about accepting a new key from the OpenWrt device, write
“yes” and press Enter key.
a. If for some reason you have reinstalled OpenWrt the device will have a different
key and you get an error about key mismatch. The error will state what is the
command line to copy-paste in your terminal to delete the old key and proceed.
3. if you want to close the session, write “exit”

Linux also usually has SCP/SFTP () clients (to open/edit/download/upload files in OpenWrt),
which may or may not be installed by default.
You need to look up your distro's
documentation or search with your package management interface for “scp” and “sftp” to find
where it is and its current installation status.
Read scp manual (http://man.cx/scp) for the
command line SCP client or google some tutorials to learn how to use it.

Midnight Commander
Midnight Commander (https://midnight-commander.org/) is Norton Commander like file
manager that works on Linux and macOS.
You can access remote files on OpenWrt via mc:

1. Press 'F9'
2. Select 'Left' panel config
3. Select 'Shell link'
4. Input 'root@192.168.1.1/' and press OK
5. Now you'll see list of files and directories in root of OpenWrt

Internally it works over scp like protocol FISH


(https://en.wikipedia.org/wiki/Files_transferred_over_shell_protocol) so it not needs for
installed SFTP () server.

https://openwrt.org/docs/guide-quick-start/sshadministration 5/6
15/9/21 11:42 [OpenWrt Wiki] Acceso SSH para recién llegados

macOS terminal emulators


On macOS (formerly Mac OSX) any terminal emulator will allow you to ssh.

1. Terminal - The macOS built-in terminal program, find it in /Applications/Utilities.


2. iTerm2 (https://iterm2.com/) a much-enhanced terminal program, donation-ware - it's
worth it.

To ssh into your OpenWrt router at 192.168.1.1, type ssh root@192.168.1.1 , then press
Return.

Chrome OS terminal emulator


On Chrome OS (), Secure Shell App (https://chrome.google.com/webstore/detail/secure-
shell-app/pnhechapfaindjhompbnflcldabbghjo?hl=en) will allow you to ssh.

Last modified: 2021/08/13 02:11 by richb-hanover

El autorregistro en la wiki ha sido deshabilitado.

Si desea contribuir a la wiki de OpenWrt, publique AQUÍ (https://forum.openwrt.org/t/applying-for-


openwrt-wiki-account/101671) en el foro o solicite acceso al IRC () .

Salvo que se indique lo contrario, el contenido de este wiki tiene la siguiente licencia:

CC Attribution-Share Alike 4.0 International

https://openwrt.org/docs/guide-quick-start/sshadministration 6/6

You might also like