- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_ssh.py
More file actions
Latest commit
15 lines (12 loc) · 400 Bytes
/
Copy pathpython_ssh.py
File metadata and controls
15 lines (12 loc) · 400 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
importparamiko
importos
command="df"
HOST=os.environ["NODE_IP"]
USERNAME=os.environ["SSH_USER"]
PASSWORD=os.environ["SSH_PASSWORD"]
client=paramiko.client.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(HOST, username=USERNAME, password=PASSWORD)
_stdin, _stdout,_stderr=client.exec_command("df")
print(_stdout.read().decode())
client.close()