标签:cli start pre tab word ram stdout cycle too
paramiko遵循SSH2协议,支持以加密和认证的方式,进行远程服务器的连接,可以实现远程文件的上传,下载或通过ssh远程执行命令。
>>> import paramiko >>> ssh = paramiko.SSHClient() >>> ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # 允许连接不在know_hosts文件中的主机 >>> ssh.connect(hostname=‘192.168.0.6‘, port=22, username=‘root‘, password=‘asdasd‘) >>> stdin, stdout, stderr = ssh.exec_command(‘ls‘) # 标准输入,标准输出,标准错误 >>> print stdout.read() 1.sql 2.txt 666.txtx 777.txtx a1 account_move.sql anaconda-ks.cfg b0 b1 b2 cycle_checking_13 data_rs_partno_checktable.sql db_calc_price_1366674_all_sql.zip ex_account.sql git-jiayou4 hahaha.txt haha.txt icbase-v3_1554112_all_sql.zip jiayou3test.sql jiayou4 jiayou_mini_db.sql jy8866.sh liangdongyang nohup.out percona-toolkit-3.0.12-1.el7.x86_64.rpm product_limit.sql release383 rosipenv shuzujilu start_jybase.sh up_jiayou383.sh up_pro.py wkhtmltox-0.12.4_linux-generic-amd64.tar.xz wkhtmltox-0.12.4_linux-generic-amd64.tar.xz.1 xqhtest
标签:cli start pre tab word ram stdout cycle too
原文地址:https://www.cnblogs.com/allenzhang-920/p/9831018.html