Forums

SSH Error: ChannelException(1, 'Administratively prohibited')

Hi all, identical issue from here, also following the help section with a European paid account, I am having the error:

2022-06-18 15:06:03,810| ERROR   | Secsh channel 0 open FAILED: open failed: Administratively prohibited
2022-06-18 15:06:03,811| ERROR   | Could not establish connection from local ('127.0.0.1', 53782) to remote ('XXX.mysql.pythonanywhere-services.com', 3306) side of the tunnel: open new channel ssh error: ChannelException(1, 'Administratively prohibited')

The code executed below:

sshtunnel.SSH_TIMEOUT = 5.0
sshtunnel.TUNNEL_TIMEOUT = 5.0
mydb = None
tunnel = None

try:
    pdb.set_trace()
    tunnel = sshtunnel.SSHTunnelForwarder(
        ('ssh.pythonanywhere.com'),
        ssh_username='xxx',
        ssh_password='xxx',
        remote_bind_address=('XXX.mysql.pythonanywhere-services.com', 3306)
    )
    tunnel.start()
    mydb = mysql.connector.connect(
        user='xxx',
        passwd='xxx', 
        host='127.0.0.1', 
        port=tunnel.local_bind_port,
        db='xxx$XXX',
    )

If i switched the SSH hostname with the european one 'ssh.pythonanywhere.com' I get this error:

Could not connect to gateway ssh.eu.pythonanywhere.com:22 : Unable to connect to ssh.eu.pythonanywhere.com: [Errno 61] Connection refused

Thanks for your help!

Have a look at our example code with instructions on what addresses and passwords to use in each location: https://help.pythonanywhere.com/pages/AccessingMySQLFromOutsidePythonAnywhere/#from-python-code. In particular, make sure that the case of the username is correct.

Yes I have followed these instructions indeed. The problem is, when I try manual SSH with the European ssh hostname my password is always wrong. With the generic ssh hostname it works fine all the time. And I am using the same password for authentication (password I use to log on pythonanywhere). European SSH hostname:

ssh -L 3306:XXX.mysql.pythonanywhere-services.com:3306 XXX@ssh.eu.pythona
nywhere.com
<<<<<<:>~ PythonAnywhere SSH. Help @ https://help.pythonanywhere.com/pages/SSHAccess
XXX@ssh.eu.pythonanywhere.com's password:
Permission denied, please try again.
XXX@ssh.eu.pythonanywhere.com's password:

With generic SSH hostname it works fine:

ssh -L 3306:XXX.mysql.pythonanywhere-services.com:3306 XXX@ssh.pythonanywhere.com
<<<<<<:>~ PythonAnywhere SSH. Help @ https://help.pythonanywhere.com/pages/SSHAccess
XXX@ssh.pythonanywhere.com's password:
Last login: Sat Jun 18 14:12:21 2022 from 90.197.243.40
Connection to ssh.pythonanywhere.com closed.

Do not use the EU hostname. You do not have an account on the EU servers.