当前位置:首页 > linux > 正文内容

python ssh 登录服务器

root6年前 (2020-09-22)linux1606

import paramiko


ssh = paramiko.SSHClient()

ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())

ssh.connect('192.168.1.197', 22, 'root', '******')

stdin, stdout, stderr = ssh.exec_command('ls')

print (stdout.read())

ssh.close()


扫描二维码推送至手机访问。

版权声明:本文由一叶知秋发布,如需转载请注明出处。

本文链接:https://zhiqiu.top/?id=9

分享给朋友:

相关文章

linux 更换apt的源

sudo sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list将archive.ubunt...

linux 切割文件split

split --help 用法:split [选项]... [输入 [前缀]] 将输入内容拆分为固定大小的分片并输出到"前缀aa"、"前缀ab",...;...

centos的新主机配置网络

centos的新主机配置网络

背景:公司因项目开发需要购置了两台主机。因为配置网络的大哥又是不在公司,但是又着急使用新主机。(旧的已经卡成狗腿了)急需解决问题,首先电脑刚插入网线又问题,不亮。只有一个网卡亮但是并不是Internet的网卡。其他四个网卡插入均不亮。换个网...

apach 启动失败 可能因为安全策略

apach 启动失败 可能因为安全策略

执行 setenforce 0再次启动systemctl restart httpdOK 搞定...

docker 日志查看

通过如下命令来获取容器的日志地址 docker inspect --format '{{.LogPath}}' 97069f94437bcat命令查看上述命令找到的日志地址cat /...

git 忽略文件不起作用 .gitignore

git rm -r --cached . git add .   git commit -m "update .gitignore"  git status查看是否是"working di...