当前位置: 首页 > news >正文

WinSCP和PuTTY在刷openwrt固件的使用教程

【openwrt必备工具】WinSCP和PuTTY的搭配与使用

PuTTY和WinSCP是管理OpenWRT固件的路由器必备工具。

WinSCP的优势在于支持多语言、可在图形化界面下管理Linux系统里的文件和存储多个会话设置以方便多设备多用户登录。PuTTY的优势在于提供与Linux终端一样的命令行控制界面。

所以,一般可先用WinSCP登录,管理文件,在必要的时候,调出PuTTY输入终端命令,实现优势互补。那既然在WinSCP中快速调用PuTTY输入终端命令是常见的事,就得让二者更好的配合,方法如下:

1.下载免安装版的WinSCP,解压至XXX\WinSCP目录(XXX表示某一个目录);
2.下载需要的语言包,解压至XXX\WinSCP目录;
3.下载免安装版的PuTTY,解压至XXX\PuTTY;
4.运行XXX\WinSCP\WinSCP.exe,出现“WinSCP登录”窗口;
5.按下“Languages”按钮,选择语言;
6.勾选“高级选项”;
7.选择树状列表中的“选项”项目;
8.按下“其它通用选项”的“选项”按钮,弹出的“选项”窗口;
9.选择“选项”窗口里树状列表中的“集成-应用程序”;
10.把“PuTTY路径”改为相对路径的“..\PuTTY\putty.exe”(这一步是关键,路径前面的“..”表示父目录,即代表上面“XXX”目录,改成这样的好处是以后只要把XXX目录下的WinSCP和PuTTY两个目录一起移动到其它任意一个目录后,这个设置依然有效);
11.勾选“记住会话密码并传给PuTTY(SSH)”项目,点“确定”按钮返回“WinSCP登录”窗口;
12.选择树状列表中的“会话”项目;
13.在“文件协议”下拉列表框中选择“SCP”;
14.在“主机名”文本框中输入“192.168.99.1”(如意·云路由默认的IP地址);
15.在“端口号”文本框中输入“22”(OpenWRT SSH服务默认的端口);
16.在“用户名”文本框中输入“root”(OpenWRT默认的管理员账户名);
17.在“密码”文本框中输入管理员账户的密码;
18.点“保存”按钮,弹出“会话另存为”窗口;
19.在“会话另存为”文本框中输入会话名称,点“确定”按钮返回“WinSCP登录”窗口;
20.在选择树状列表中的“会话-存储的会话”项目;
21.选择会话名称,点“登录”按钮,弹出“警告”窗口;
22.按“否”按钮,弹出“WinSCP”主界面,左侧是本地目录,右侧是路由器的Linux系统目录;
23.可以在本地目录和路由器Linux系统目录间拖拽文件完成文件复制传输,在路由器的Linux系统目录的文件上按双击可以打开文件,按“Ctrl+P”快捷键(或按“命令”主菜单-“在PuTTY中打开”),弹出“PuTTY Security Alert”窗口,按“否”键钮,可直接打开PuTTY窗口并自动登录路由器的Linux终端。

刷固件:

1.1 Root无密码时: 可用HFS构建HTTP文件服务器. 如:http://192.168.1.224/wr703n-eok.bin, 然后CMD命令窗口中输入命令:
telnet 192.168.1.1
cd /tmp
wget http://192.168.1.224/wr703n-eok.bin
1.2 Root有密码时: 先将固件用winscp上传到/tmp/下或者用上面的wget命令, 然后用putty或者securecrt登陆路由器
2. mtd -r write /tmp/固件.bin firmware, 成功后会出现 rebooting…
注: dd下用 linux,openwrt下用 firmware

— mtd 源码中的相关部分:

static void usage(void)
{fprintf(stderr, "Usage: mtd [<options> ...] <command></command> [<arguments> ...] <device>[:<device>...]\n\n""The device is in the format of mtdX (eg: mtd4) or its label.\n""mtd recognizes these commands:\n""        unlock                  unlock the device\n""        refresh                 refresh mtd partition\n""        erase                   erase all data on device\n""        write <imagefile>|-     write <imagefile> (use - for stdin) to device\n""        jffs2write <file>       append <file> to the jffs2 partition on the device\n");if (mtd_fixtrx) {fprintf(stderr,"        fixtrx                  fix the checksum in a trx header on first boot\n");}fprintf(stderr,"Following options are available:\n""        -q                      quiet mode (once: no [w] on writing,\n""                                           twice: no status messages)\n""        -n                      write without first erasing the blocks\n""        -r                      reboot after successful command\n""        -f                      force write without trx checks\n""        -e <device>             erase <device> before executing the command\n""        -d <name>               directory for jffs2write, defaults to \"tmp\"\n""        -j <name>               integrate <file> into jffs2 data when writing an image\n");if (mtd_fixtrx) {fprintf(stderr,"        -o offset               offset of the image header in the partition(for fixtrx)\n");}fprintf(stderr,
#ifdef FIS_SUPPORT"        -F <part>[:<size>[:<entrypoint>]][,<part>...]\n""                                alter the fis partition table to create new partitions replacing\n""                                the partitions provided as argument to the write command\n""                                (only valid together with the write command)\n"
#endif"\n""Example: To write linux.trx to mtd4 labeled as linux and reboot afterwards\n""         mtd -r write linux.trx linux\n\n");exit(1);
}</part></entrypoint></size></part></file></name></name></device></device></file></file></imagefile></imagefile></device></device></arguments></options>

Opkg 是一个轻量快速的套件管理系统,目前已成为 Opensource 界嵌入式系统标准。
常用于路由、交换机等嵌入式设备中,用来管理软件包的安装升级与下载。常用命令如下:
opkg update 更新可以获取的软件包列表
opkg upgrade 对已经安装的软件包升级
opkg install 安装指定的软件包
opkg instal /tmp/xxx.ipk
opkg install http://openwrt.8800.org:82/nwan.ipk
opkg install http://openwrt.8800.org/luci-app-nwan.ipk
opkg install –force-reinstall http://192.168.1.224/uhttpd_32_ar71xx.ipk
opkg remove 卸载已经安装的指定的软件包. opkg remove luci-i18n-chinese
opkg list
opkg list-installed

Force Options:
–force-depends Install/remove despite failed dependencies
–force-maintainer Overwrite preexisting config files
–force-reinstall Reinstall package(s)
–force-overwrite Overwrite files from other package(s)
–force-downgrade Allow opkg to downgrade packages
–force-space Disable free space checks
–force-postinstall Run postinstall scripts even in offline mode
–force-remove Remove package even if prerm script fails
–noaction No action – test only
–download-only No action – download only
–nodeps Do not follow dependencies
–force-removal-of-dependent-packages
Remove package and all dependencies
–autoremove Remove packages that were installed
automatically to satisfy dependencies
-t Specify tmp-dir.
–tmp-dir Specify tmp-dir.

一般我们在openwrt下用opkg安装软件有两种:
1. 连上网络后从官方网站安装 opkg update; opkg install XXX.ipk;
opkg install http://openwrt.8800.org/luci-app-nwan.ipk
2. PC上把软件下载下来,传到路由器tmp目录安装 opkg install /tmp/XXX.ipk

对于1来说,如果路由暂时上不了网,就无法使用,方法2又有些麻烦. 这里提供的方法是:
1. 修改/etc/opkg.conf, 把里边第一行那个网址改成本地服务器放安装包的服务目录,
#src/gz snapshots http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages
src/gz snapshots http://192.168.1.224/packages-r31296
2. 把相关的 packages 目录下的文件都放在上步定义的目录下(packages-r31296为目录名)
3. 在本机上用 HTS 开启http服务, 添加上面的目录
4. 现在可以像方法1一样使用升级了

工作图片如下:
这里写图片描述

版权声明:本文为博主原创文章,未经博主允许不得转载。

转载于:https://www.cnblogs.com/yangquanhui/p/4937499.html

http://www.xdnf.cn/news/839503.html

相关文章:

  • 终端不能联网_品牌维护森算云告诉你:大智慧舆情终端有什么作用
  • VSFTP介绍安装使用
  • Python爬虫实战五之模拟登录淘宝并获取所有订单
  • 【嵌入式开发】树莓派支持硬编码的视频套件
  • 2020年生肖码表图_2020年最好的计时码表,是这4款
  • 爬虫学习(一)---爬取电影天堂下载链接
  • 深度学习openpose人体姿态检测识别-动作检测
  • 从Idea到付诸实践,你必须要知道的
  • 国内主流视频分享网站主页对比
  • 饭统网倒闭:不创新、不放权就是作死
  • 物联网RTOS新贵-TencentOS tiny入门
  • 当我们谈「以消费者为中心」时,实际上在谈什么?| 消费者数字化运营从0到1
  • pubg绝地求生大厅发生了错误/显示与主机失去连接一键解决
  • 从零开始训练一个大模型教程
  • camera isp(Image Signal Processor)
  • ESET NOD32 最新更新有效的升级ID用户名和密码
  • [Python]输入星座名查询对应Unicode编码图案
  • spring boot应用内部实现应用自身重启的两种方式
  • 常见海报的尺寸
  • Unity--向量点乘叉乘在Unity中的使用
  • 天玑1100和天玑920处理器哪个好
  • PostScript(PS 格式)讲解
  • 数电设计--交通灯控制系统
  • 网络监控软件PRTG的配置及使用
  • 文心一言:中国版“ChatGPT”测评
  • 极市平台|100+深度学习各方向数据集资源大盘点
  • 20+ 个免费和高级的 Web 视频播放器
  • 大数据---MySQL基础---day1
  • 十款开源数据集成工具
  • 50款七夕表白代码大合集(超全)