zoukankan      html  css  js  c++  java
  • python调用 sshpass

    [root@qinhan ~]# ifconfig
    eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 172.16.43.105  netmask 255.255.255.0  broadcast 172.16.43.255
            inet6 fe80::20c:29ff:fe22:1f4f  prefixlen 64  scopeid 0x20<link>
            ether 00:0c:29:22:1f:4f  txqueuelen 1000  (Ethernet)
            RX packets 2  bytes 120 (120.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 10  bytes 768 (768.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    eno33554984: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 192.168.27.100  netmask 255.255.255.0  broadcast 192.168.27.255
            inet6 fe80::20c:29ff:fe22:1f59  prefixlen 64  scopeid 0x20<link>
            ether 00:0c:29:22:1f:59  txqueuelen 1000  (Ethernet)
            RX packets 13415  bytes 9012322 (8.5 MiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 8337  bytes 1137911 (1.0 MiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
            inet 127.0.0.1  netmask 255.0.0.0
            inet6 ::1  prefixlen 128  scopeid 0x10<host>
            loop  txqueuelen 0  (Local Loopback)
            RX packets 1301  bytes 132447 (129.3 KiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 1301  bytes 132447 (129.3 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    [root@qinhan ~]# python
    Python 3.6.2 (default, Jan 10 2018, 16:15:47) 
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import subprocess
    >>> subprocess.run('sshpass -p root ssh root@192.168.27.3 -o "StrictHostKeyChecking no"',shell=True)
    Last login: Fri Jan 19 10:42:16 2018 from node2.magedu.com
    [root@node1 ~]# ifconfig
    eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 172.16.43.102  netmask 255.255.255.0  broadcast 172.16.43.255
            inet6 fe80::20c:29ff:fe53:14fc  prefixlen 64  scopeid 0x20<link>
            ether 00:0c:29:53:14:fc  txqueuelen 1000  (Ethernet)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 10  bytes 768 (768.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    eno33554960: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 192.168.27.3  netmask 255.255.255.0  broadcast 192.168.27.255
            inet6 fe80::20c:29ff:fe53:1406  prefixlen 64  scopeid 0x20<link>
            ether 00:0c:29:53:14:06  txqueuelen 1000  (Ethernet)
            RX packets 1898  bytes 198151 (193.5 KiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 785  bytes 175186 (171.0 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
            inet 127.0.0.1  netmask 255.0.0.0
            inet6 ::1  prefixlen 128  scopeid 0x10<host>
            loop  txqueuelen 0  (Local Loopback)
            RX packets 3588  bytes 310356 (303.0 KiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 3588  bytes 310356 (303.0 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    [root@node1 ~]# 
  • 相关阅读:
    Excutor线程池
    java-集合学习-底层实现
    java-接口—策略模式
    java开发技巧
    精进之道——为什么要问老师,不遮掩自己的弱点
    如何学习——为什么不想听课
    如何学习——如果差距过大怎么办
    Yii 之控制器响应
    Yii 之控制器创建使用
    PHP 之命名空间
  • 原文地址:https://www.cnblogs.com/qinhan/p/8315818.html
Copyright © 2011-2022 走看看