惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
Help Net Security
Help Net Security
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
C
Cisco Blogs
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
L
LINUX DO - 热门话题
Security Latest
Security Latest
A
Arctic Wolf
G
GRAHAM CLULEY
月光博客
月光博客
S
Securelist
D
Docker
J
Java Code Geeks
T
Troy Hunt's Blog
T
Tenable Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
SecWiki News
SecWiki News
S
Security @ Cisco Blogs
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
L
LINUX DO - 最新话题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
aimingoo的专栏
aimingoo的专栏
博客园 - 【当耐特】
H
Heimdal Security Blog
The Hacker News
The Hacker News
博客园 - 三生石上(FineUI控件)
Application and Cybersecurity Blog
Application and Cybersecurity Blog
N
Netflix TechBlog - Medium
Vercel News
Vercel News
Forbes - Security
Forbes - Security
B
Blog RSS Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
B
Blog
MongoDB | Blog
MongoDB | Blog
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
S
Secure Thoughts
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Check Point Blog
云风的 BLOG
云风的 BLOG
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
The Blog of Author Tim Ferriss
L
Lohrmann on Cybersecurity
F
Full Disclosure
D
Darknet – Hacking Tools, Hacker News & Cyber Security
P
Proofpoint News Feed

博客园 - LiuYanYGZ

2025.04.15交通事故记录(沈阳、爸爸) 10KG、2KG盘称 摩托车贝纳利302S换机油 excel身份证号验证 妈妈的药:血府逐瘀丸、天麻钩藤颗粒、半夏白术天麻汤、杞菊地黄丸、当归补血汤、糠酸莫米松凝胶、尿素维E乳膏 桂附地黄丸、舒筋活血片 辽宁省沈阳市居住证办理2026.01.21 北京健康证(立水桥地铁站附近)第二次去2025.12.28 鼻窦炎、鼻炎、花粉过敏 70迈M800后摄像头改装 D07线 京B摩托车第6年年检,《京顺机动车检测场》150元不用预约 source insight4菜单工具按钮变乱恢复 探索Go语言性能优化:全面解析pprof工具 检查一个IP地址是否在一个网段中 __attribute__((visibility(“default“)))含义 ls | tee 1.txt 如何拿到ls的返回值$? 使用golang访问linux telnet服务器 手机CPU性能天梯图 Poedit Pro国际化翻译编辑器 Proe和Creo的区别 Ubuntu修改DNS方法(临时和永久修改DNS) Ubuntu中apt设置国内源(以阿里云为例) Ghidra(反汇编工具)
在本机A中执行expect脚本:ssh到B,在B机器上从A机器scp文件到B
LiuYanYGZ · 2026-03-02 · via 博客园 - LiuYanYGZ

 在本机A中执行expect脚本ru.sh,可以做到 "从A ssh到B,在B机器上从A机器scp文件到B"

OAM/tools/Dispatch_EURU/ru.sh内容如下:

#!/usr/bin/expect

set timeout 15

set local_file [lindex $argv 0]
set ip [lindex $argv 1]
set remote_path [lindex $argv 2]

set password "12345678"
set scp_result "1"




spawn ssh -o StrictHostKeyChecking=no $ip
    expect {
        "password:" {
            send "$password\r"
            expect {
                "root@" {
                    #send "scp sftpuser2@192.168.30.1:${local_file} ${remote_path}\r"
                    send "scp -o StrictHostKeyChecking=no sftpuser2@192.168.30.1:${local_file} ${remote_path}\r"
                }
            }
            expect {
                       "yes/no" { send "yes\r";exp_continue } 
                       "y/n" { send "y\r";exp_continue } 
                "password:" { send "Sftpuser2.password\r"; exp_continue}
                "100%" {set scp_result "0"}
            }
            expect {
                "root@" {
                    send "exit\r"
                }
            }
        }
    }
    expect eof


exit "$scp_result"
./ru.sh /usr/local/xxxx/repository_run/5.1.3.255.xxxx.260131_beta/OAM/tools/Dispatch_EURU/ru_1.sh 192.168.30.207 /tmp/ ; echo $?

image