I use the below code, this works with special characters in the password: import paramiko ssh = paramiko.SSHClient() ip1 = 'X.X.X.X' u1 = 'user2' p1 = '#$!@%&' ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(ip1, port=5252, username=u1, password=p1) stdin, stdout, stderr = ...