问题原文
原帖链接 · Pinke Helga · CC BY-SA 3.0
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 [email omitted]
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?
已采纳解答
原帖链接 · tgharold · CC BY-SA 3.0
For the host, you can check the LOGIN_NAME_MAX via either man useradd or getconf 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.
Host alias-hostname.example.com
HostName realname.example.com
Port 875
User reallylongusername
- Port is only needed if you have the SSH service on an alternate port (which is good practice).
- Host is used if you want to refer to your SSH host by an alternate name. Very commonly used in cases where you want multiple SSH configurations to point at the same server, but use different usernames.
Once you have a ~/.ssh/config file, you can talk to your host using ssh alias-hostname.example.com or ssh realname.example.com without needing to specify reallylongusername or other options on the command line. Tab-completion will also start to work for the hostname, so you can type ssh alias[tab] and it will expand to ssh alias-hostname.example.com.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
