大网数据广告活动
服务器运维问答

Can an (Open)SSH login name have more than 30 characters?

· 52CE 我爱测

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 s…

问题原文

原帖链接 · 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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-05-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。