Linux Shell脚本实现自动交互
来源:互联网 发布:买车软件哪个好 编辑:程序博客网 时间:2024/05/22 17:34
方法一:(以OpenSSH编译完成之后的 拷贝和生成key 为例)
#!/bin/bashDIR_PATH=$HOME/sshdfilecp sshd $DIR_PATH/sbincp scp sftp ssh ssh-add ssh-agent ssh-keygen ssh-keyscan $DIR_PATH/bincp sftp-server ssh-keysign $DIR_PATH/libexeccp sshd_config ssh_config $DIR_PATH/etcchmod 755 $DIR_PATH/var/emptyssh-keygen -t rsa1 -f ssh_host_key -N "" << EOFyEOFssh-keygen -t rsa -f ssh_host_rsa_key -N "" << EOFyEOFssh-keygen -t dsa -f ssh_host_dsa_key -N "" << EOFyEOFcp ssh_host_* $DIR_PATH/etc
方法二:(以FTP用户自动登录为例)
#!/usr/bin/expectset file [lindex $argv 0];set timeout -1; spawn ftp 192.168.1.*** expect "Name" send "username***\r" expect "Password" send "passwd***\r"expect "ftp>"send "hash\r"expect "*ftp>*"send "put $file\n"expect "*ftp>*"send "bye\r"expect "*Goodbye*"expect eofexit【测试】:./autoftp.sh filename
【效果】:自动登陆FTP用户”username***“, 将”filename“ 文件上传至服务器。
- Linux Shell脚本实现自动交互
- Linux-----Shell脚本交互实现自动输入密码
- Shell脚本——与Linux Shell自动交互
- Linux下实现脚本的自动交互
- Linux Shell自动交互
- 用expect实现shell脚本的自动交互
- shell脚本实现无密码交互的SSH自动登陆
- shell脚本实现无密码交互的SSH自动登陆
- shell脚本实现无密码交互的SSH自动登陆
- shell脚本实现无密码交互的SSH自动登陆
- shell脚本实现无密码交互的SSH自动登陆
- shell脚本实现无密码交互的SSH自动登陆
- shell中自动化交互实现--一般用户脚本自动切换
- shell脚本调用expect命令实现命令行自动交互
- 实现Linux Shell自动交互的三种方法
- Linux Shell Script Programming —— 实现自动交互
- linux shell使用expect实现sftp的自动交互
- Linux基于expect(tcl)实现shell自动交互
- 信息采集系统开发第一版
- Sql Server 游标的简单使用
- 计算机经典书籍(转载)
- Linux下执行ifconfig遇到错误: bash:ifconfig:command not found
- malloc与free 动态内存的申请与释放
- Linux Shell脚本实现自动交互
- Activity:前台+带UI的屏幕 Service:后台+不带UI BroadcastReceiver:不带UI
- 数据库游标
- 技能C++一版
- php各种编码集详解和在什么情况下进行使用
- 黑马程序员—C#中结构和类的区别
- inux errno 错误对照表
- checking network configuration requirements . The overall result of this check is: Not executed
- JSON必知