FIXME This page is not fully translated, yet. Please help completing the translation.
(remove this paragraph once the translation is finished)

SSH Access for Newcomers

默认情况下,OpenWrt 设备始终侦听端口22/tcp上的SSH命令行访问。 要通过SSH连接到您的路由器, 您需要在终端仿真器中输入以下命令(对于路由地址

ssh root@

第一次通过ssh访问路由器时,您可能会看到关于 RSA key fingerprint 的警告. 如果您确定这是 OpenWrt 设备的地址,只需键入 yes 然后按回车. 然后输入您给路由器的密码,如果这是初始设置,请按回车. 下面是一个会话示例:

$ ssh root@                                                    <== 你输入这个
The authenticity of host ' (' can't be established.
RSA key fingerprint is SHA256:4VbDA/MOc7inPiyllF5f0r3Q6iEx89ddKdhLGBovsiY.
Are you sure you want to continue connecting (yes/no)? yes                <== 和这个
Warning: Permanently added '' (RSA) to the list of known hosts.
root@'s password:                                              <== 这里输入密码

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:~#                                                               <== 在此处键入下一个命令

要结束与你路由器的 ssh 会话 , 请键入 exit, 然后按回车. 本页的其余部分介绍了几种终端模拟器, 可用于 Windows, Linux, 或 macOS 上访问 OpenWrt 设备.

可使用 Windows 终端或传统的 PowerShell、Command Prompt、ConHost 或 WSL Bash。PuTTY、MinGW(与 Git 一起安装)、Cmder、SmarTTY 和 WinSCP 等第三方程序也是可以提供 SSH 进入 OpenWrt 路由器的终端模拟器。

Windows 终端、PowerShell 和命令提示符允许使用 SSH 客户端。该客户端现在默认可用,但如果你的 Windows 版本较老,你可以按照本指南启用 SSH

如果您已经安装了 WSL 发行版,SSH客户端通常会预装在其中。

如果你打开了 cmd.exe, powershell.exe 或者 wsl.exe ,传统的 ConHost 终端就会打开。 否则, 您可以从商店安装最新的 Windows Terminal 并从那里选择这些 shells 中的任何一个.

  1. 打开上述任何终端模拟器并输入 ssh root@ (“ssh” 是命令, “root” 是您要连接的OpenWrt用户, “” 是 OpenWrt 默认 IP 地址)
  2. 将出现一条关于接受来自OpenWrt设备的新密钥的消息, 输入 “yes” 后并按回车.
    1. 如果由于某种原因,您重新安装了OpenWrt,那么设备将有一个不同的密钥,并且您会收到一个关于密钥不匹配的错误. 错误将说明在终端中复制粘贴删除旧密钥并继续的命令行. 执行并重试.
  3. 如果您想关闭会话,请输入 “exit”

Windows 10 可选的 SSH 特性还包括 SCP 客户端(通过SSH进入在OpenWrt中执行打开/编辑/下载/上传文件). 试试谷歌或度娘一些 SCP 教程来学习如何使用它. 否则, 使用 WinSCP,这对 SCP 新手来说更容易.

Powershell 提供 SSH 访问。

Windows Subsystem for Linux 是在 Windows 上直接运行所选 Linux 环境(包括大多数命令行工具、实用程序和应用程序)的便捷方法。有关如何在 Windows 10 上安装 WSL 的详细步骤,请参阅微软的文档:


  1. https://www.putty.org下载Putty: 只需可选从 Alternative binary files 部分选择下载32位或64位 putty.exe 二进制文件.
  2. 在你的Windows上打开 putty.exe → 弹出Putty的登录窗口.
  3. 转到Putty登录窗口左侧的 Session 类别, 在右侧 Host Name (or IP address) 下的文本框输入OpenWrt设备的IP地址 (e.g. , 保留默认提供的端口 22.
  4. 单击底部的 Open 按钮打开连接. 这将弹出一个shell窗口, 正在请求 login as. 使用您以前定义的OpenWrt密码作为 root 登录. 如果您尚未在 “root” 上设置密码, 则不会要求您输入密码.
  5. 完成后,您将登录到OpenWrt命令行.

Setting up key-based authentication.

  1. Generate a key pair using puttygen.exe. Save the private key to the PC and add the public key to /etc/dropbear/authorized_keys on your OpenWrt device.
  2. Connection → SSH → Auth: In the box “Authentication Parameters” under “Private key file for Authentication” state the path to your private key file for this connection (e.g. the openwrt.ppk file you created before). Best is to click “Browse...” and select the file via the file dialog.

Automating connections.

  1. Connection → Data: In the box “Login details” enter the “Auto-login username” which is root.
  2. Load, save or delete a stored session, enter openwrt.lan in Saved Sessions and click the Save button.
  3. To make a PuTTY shortcut with an automatic login, create one and append the saved session with an @ sign, for example call PuTTY with: putty.exe @openwrt.lan

WinSCP allows you to browse the OpenWrt file system in Windows Exlorer like GUI-style.

  1. 下载 WinSCP,获取非 Beta 版 安装包 or 便携式可执行文件 并将其安装或解压到 Windows 上。
  2. 启动 WinSCP.exe, WinSCP 的登录窗口将弹出。
  3. Click on New Site on the left, ensure File protocol is set to scp then enter your OpenWrt device IP address ( on the right side into Host name, keep the default port 22. In User name enter root, in Password, enter your root password (or leave blank, if you have not set a password yet)
  4. 点击窗口底部的登录。
  5. 完成。 现在,您可以用类似 Exlorer 的方式查看 OpenWrt 文件系统了。

使用 WinSCP 集成的 GUI 编辑器编辑 OpenWrt 配置文件。

  1. 要使用 WinSCP 基于 GUI 的编辑器编辑 OpenWrt 配置文件,只需右键单击 WinSCP 中的文件,然后从上下文菜单中选择 编辑

Cmder for Windows is an open-source terminal emulator that runs on Windows. It is free to use and provides an easy “command line shell” that allows you to ssh into OpenWrt. Its attractive fonts and color scheme are easy on the eyes. The Full distribution is preferred (over the mini distribution), since it provides a bash emulation, with a Unix-y suite of commands.

  1. Download Cmder.
  2. Unzip the file.
  3. Open the Cmder folder, and double-click the Cmder icon. You'll see a Cmder window open similar to the image below.
  4. To ssh into the OpenWrt router at, type ssh root@ then press Return.

SmarTTY gives you command line access to OpenWrt and allows you to open/edit/download/upload files in OpenWrt, and is overall more modern and user-friendly than PuTTY (another tool detailed below).

  1. Download SmarTTY, choose “download” for the installer, or “portable version” if you want it as a standalone program that works without installation.
  2. after installation or after unzipping the archive, doubleclick on SmarTTY executable file.
  3. You will be greeted by a window with two choices, doubleclick on “setup a new SSH connection” (the other option is for serial connections, for usb-TTL dongles and somesuch you connect to the device's debug serial pins on the board, we won't use that now).
  4. The window changes into the SSH setup, write the following info:
    1. Host name: OpenWrt device IP address (default is )
    2. User Name: root (this is the “administrator” and only user in default OpenWrt)
    3. Password: leave this blank for your first connection, then write the password you set up (either in Luci GUI or after your first SSH access)
  5. Click “Connect” button at the bottom, and you will now see a big terminal screen coming up
  6. A default OpenWrt firmware lacks the server component to allow you to open/edit/view/upoad/download files in SmarTTY, so after you have connected to the internet write opkg update && opkg install openssh-sftp-server to install it. If the next step fails, it might be necessary to reboot the OpenWrt device for this new service to start up properly.
  7. Now you can click on File → Open a Remote File to open a popup that shows the file system of the OpenWrt device, and you can navigate in it and open text files for example as normal (they will open in a SmarTTY text editor window)
  8. If you want to upload or download files to/from a specific folder in the device, you can click on SCP menu and choose the most appropriate action from there.

After the first time you connected to a device, SmarTTY saved a profile, so you can connect again to the same device (at that IP address with that password) by just doubleclicking its icon on the first window you see when starting SmarTTY. You can right-click on this profile icon to edit it again, if needed.

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

  1. Open a terminal emulator and write ssh root@ (“ssh” is the command, “root” is the OpenWrt user you are connecting to, and “” 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.
    1. 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 for the command line SCP client or google some tutorials to learn how to use it.

Midnight Commander 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@' 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 so it not needs for installed SFTP server.

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

  1. Terminal - 内置的终端程序,可在 /Applications/Utilities 中找到。
  2. iTerm2 是一款功能更强大的终端程序,捐赠软件,值得购买。

要 ssh 进入位于 的 OpenWrt 路由器,请键入 ssh root@,然后按 Return 键。

ChromeOS 上, 安全外壳 (SSH) 可以让你使用 SSH。

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2023/12/23 09:59
  • by heybrowhatsup