I found this code to connect to remote sftp server with the help of username ,password and host but i also need to include the port number, can any one let em know how to include the port number in this code and also for this piece of code 'parmiko.util.log_to_file(log_filename)' what should i hard code for log_filename ??Iam runnign this code in unix environment.
import os
import paramiko
server, username, password = ('host', 'username', 'password')
ssh = paramiko.SSHClient()
parmiko.util.log_to_file(log_filename)
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())' #In case the server's key is unknown,'
#we will be adding it automatically to the list of known hosts
ssh.load_host_keys(os.path.expanduser(os.path.join("~", ".ssh", "known_hosts"))) #Loads the user's local known host file
ssh.connect(server, username=username, password=password)
ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command('ls /tmp') print "output", ssh_stdout.read() #Reading output of the executed co'mmand
error = ssh_stderr.read() #Reading the error stream of the executed command
print "err", error, len(error) #Transfering files to and from the remote machine'
sftp = ssh.open_sftp()
'sftp.get(remote_path, local_path)'
sftp.put(local_path, remote_path)
sftp.close()
ssh.close()