pexpect-pxssh-登陆Linux-执行命令
#!/usr/bin/python
import pexpect
import pxssh
try:
remote=pxssh.pxssh()
hostname=raw_input('hostname:')
username=raw_input('username:')
password=raw_input('password:')
remote.login(hostname,username,password)
remote.sendline('cd /opt/autotest/')
remote.prompt()
remote.sendline('ll')
remote.prompt()
print remote.before
print('成功了吧')
remote.logout()
except pxssh.ExceptionPxssh,e:
print'pxssh failed on login'
print str(e)
pexpect-pxssh-登陆Linux-执行命令的更多相关文章
- jenkins 执行ssh 远程linux执行命令
1.远程机器编写脚本: 脚本名称为: /app/jboss/jboss-as/logs/ALL_SERVICE_STOP.sh 功能为:停止某个服务器某个目录下面的所有应用 #!/bin/bash p ...
- Python-SSH批量登陆并执行命令
Python-SSH批量登陆并执行命令 #!/usr/bin/env python #-*- coding:utf-8 -*- import paramiko from time import cti ...
- Python远程linux执行命令
1.远程登录到linux上,使用到的模块paramiko #远程登陆操作系统 def ssh(sys_ip,username,password,cmds): try #创建ssh客户端 client ...
- Linux - 执行命令与脚本
001 - Linux执行多条命令 方法1:在命令行下可以一次性粘贴多条语句,shell会依次执行并输出结果 方法2:在一个命令行中,用分号将各个命令隔开或者使用&&连接各个命令 示例 ...
- Linux执行命令./command与直接输入命令的区别
我们知道查看文件属性的命令ls的完整文件路径为:/bin/ls(这是绝对路径,)问什么我可以在任何地方执行,任何目录下输入ls就一定可以显示出一些信息而不会说找不到该/bin/ls命令,这是因为不同的 ...
- Mysq登陆后执行命令提示You must SET PASSWORD before executing this statement
mysql 安装完成后,在输入命令行时,提示:You must SET PASSWORD before executing this statement 提示必须设置密码,我想不是已经设置了密码吗? ...
- ssh登陆并执行命令不退出
如果希望SSH登陆后先执行shell命令,可以这样: ssh user@ip -t "cd /data ; /bin/bash"
- Linux执行命令时遇到的些问题
1.执行lsb_release -a,提示 未安装lsb_release导致的,执行一下yum install redhat-lsb -y,问题解决 2.配置tomcat站点后重启tomcat,提示找 ...
- linux执行命令返回码释义
Linux 操作系统错误代码解释 0.错误代码1-10 OS error code 0: Success 操作系统错误代码0:成功 OS error code 1: Operation not per ...
- Linux执行命令unable to create new native thread问题
对于系统的Linux的问题 主要是线程数有限制max user processes 参数限制 修改这个参数涉及到修改两个文件 vi /etc/security/limits.conf 增加如下内容: ...
随机推荐
- opencv 中cvZero()的使用
cvZero(CvArr* ar); // 是让矩阵的值都为0,有初始化的作用, Eg: IplImage img=cvCreateImage(cvSize(640,480),IPL_DEPTH_ ...
- js 数组,字符串,JSON,bind, Name
/** * Created by W.J.Chang on 2014/5/23. */ // 判读是否是数组的方法 console.log(Array.isArray(new Array)); con ...
- 大型票务系统中username和password的安全性问题
讨论请移步至:http://www.zhiliaotech.com/ideajam/idea/detail/307 相关文章: <今天你买到票了吗?--从铁道部12306.cn站点漫谈电子商务站 ...
- 从零开始学习UNITY3D(GUI篇 GUI.Window)
unity3d里面,也是包含window窗体的,下面看一下GUI.Window方法的详情 下面我们用代码实现一个通过开关显示窗体的隐藏和显示的功能,代码如下: public class windows ...
- Windows Server 2003 安装Sql Server 2005 问题处理
安装途中遇到: 问题1.无法找到产品Microsoft SQL Server Native Client的安装程序包.请使用安装包sqlncli.msi的有效副本重新安装? 答:安装SQL Serve ...
- Csharp多态的实现(接口)
1.什么是接口 接口可以看做是一个标准, 所有继承的子类需要按照接口中声明的方法来 接口用关键字 interface 修饰,接口的名字一般是I.........able ,表示我有什么能力 接口一般是 ...
- C++_前置声明
为什么要有前置声明? eg: -定义一个类 class A,这个类里面使用了类B的对象b,然后定义了一个类B,里面也包含了一个类A的对象a,就成了这样: //a.h #include "b. ...
- 使用Docker官方的Django包【转】
官方Django docker,并没有安装Django 所以需要 在requirements.txt中配置Django 具体安装流程可以参考:http://www.logme.cn/blog/51/u ...
- solr 通过URL删除索引
使用:update 参数:stream.body=<delete><query>date:[2014-06-15T00:00:00Z TO *]</query>&l ...
- leetcode 31. Next Permutation(字典序的下一个)
描述: Implement next permutation, which rearranges numbers into the lexicographically next greater per ...