Spaces:
Running
Running
import paramiko | |
# create ssh client | |
ssh_client = paramiko.SSHClient() | |
# remote server credentials | |
host = "s1.serv00.com" | |
username = "hashir672" | |
password = "gVlwXbMsxPAA36%!OSIm" | |
port = 22 | |
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | |
ssh_client.connect(hostname=host,port=port,username=username,password=password) | |
ftp = ssh_client.open_sftp() | |
files = ftp.listdir() | |
print("Listing all the files and Directory: ",files) | |
# print('connection established successfully') | |
ssh_client.close() |