Community discussions

MUM Europe 2020
just joined
Topic Author
Posts: 1
Joined: Tue Aug 21, 2018 6:48 pm
Location: South Africa

Ampersand in Password

Mon Jan 28, 2019 6:56 am

Hi All,

I am using Python Paramiko for an SSH script to connect to Mikrotik OS.

I have the following:


When connecting via SSH using the Paramiko client pass1 works perfectly and I can execute my commands.

When using pass 2 that has a "special character" is only times out.

This is looking like Mikrotik RouterOS is not accepting it correctly as I have escaped the special character in Paramiko with no luck.

Any ideas on this? Your help would be appreciated.

See my code below.

import paramiko
ip_address = 'X.X.X.X'
us3r = 'admin'
pass1 = 'pass1&'
ssh_client = paramiko.SSHClient()
ssh_client.connect(hostname=ip_address, port=22, username=us3r, password=pass1, look_for_keys=False, timeout=5)
Posts: 44
Joined: Tue Aug 07, 2018 8:25 am

Re: Ampersand in Password

Tue Jan 29, 2019 2:42 pm

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.connect(ip1, port=5252, username=u1, password=p1)
stdin, stdout, stderr = ssh.exec_command('ping count=1')
output = stdout.readlines()

Who is online

Users browsing this forum: Google [Bot] and 28 guests