快速登陆vsftpd的expect脚本

快速登陆vsftpd的expect脚本nginx

[root@canal ~]# cat /usr/bin/ftp-login.expect
#!/usr/bin/expectweb

set timeout 30
spawn ftp 公网IP/内网IP 5xxx7
expect "Name 192.168.xx.xx:root): "
send "ftpuser\r"
expect "Password:"
send "ftppasswd\r"
expect "ftp> "
#send "cd ops\r"
send "ls\r"
interactbash

=========
chmod 775 /usr/bin/ftp-login.expect
注意:
可能会须要安装expext命令,yum -y install expect
手动登陆一遍ftp ,觉得多是服务器中英文的关系,有的地方须要手动改为适配的。
好比这个expect "Password:",en 的字符集是这样的显示,但是个别的系统安装时可能选的是中文,
那这里显示就是 "密码" ,若是不改就适配不上。服务器

spawn 是你要干什么事
expect 是须要匹配的内容
send 是匹配到了,要干什么事情。网络

上面是主要部分,下面是执行部分。
[root@canal ~]# cat .bashrc
alias ftplogin="/usr/bin/expect /usr/bin/ftp-login.expect"
alias list="cat /etc/motd"ide

效果:
快速登陆vsftpd的expect脚本spa

motd 文件是欢迎页面,每次登录进来都会显示,
另外由于已经作了别名alias了,因此直接输入ftplogin就会登录ftp
list 的名字只是用于本身记忆,由于有时候本身可能忘记了,博客

下面是个人匹配内容,敏感信息会打码
快速登陆vsftpd的expect脚本it

FileZilla 登录截图:
快速登陆vsftpd的expect脚本class

下一遍文章结合vsftpd 上传和nginx 做为PCweb下载,以为有用的能够再博客里找下。目的是:网络缘由可能使用ftp客户端下载特别慢。而有一个小白根本不会用,因此只给他们一个网址就行了,由于网址下载走的是你本地的网速,相比较转了N手的下载仍是蛮快的。

相关文章
相关标签/搜索