I have to login via SSH to a web hosting server. Unfortunately the login name equals the domain having more than 30 characters. OpenSSH client on debian based linux system cuts the login name to a limit of 30 characters on both syntax:
ssh login@example.com
ssh -l login example.com
Is there a limit in the specs of SSH protocol? Is it a limit of OpenSSH only? Is it a limit of unix based system user names?
Is there a way to get around such a limitation?
Best Answer
For the host, you can check the LOGIN_NAME_MAX via either
man useradd
orgetconf LOGIN_NAME_MAX
, for the most part you are limited to 32 characters on Linux. alias-hostname.example.com However, one possible workaround would be to put your username into a~/.ssh/config
file.I don't know whether OpenSSH can handle a longer username in the config file or not. But it's worth a try.
Once you have a
~/.ssh/config
file, you can talk to your host usingssh alias-hostname.example.com
orssh realname.example.com
without needing to specifyreallylongusername
or other options on the command line. Tab-completion will also start to work for the hostname, so you can typessh alias[tab]
and it will expand tossh alias-hostname.example.com
.