Mailing List Archive

Is there any way in the ssh config file to shorten the "hostname's password" request?
I have an ssh login on a hosting service where the hostname of the
system I log onto is ridiculously long:-

qnhjuc5h8w3s@sxb1plzcpnl489538.prod.sxb1.secureserver.net

So when I connect I get a very long "<name>'s password:" which I find
rather distracting, not to mention that it doesn't really tell me what
I'm logging into.

I know I can set alternative (shorter) host names by using 'Host'
sections in my ssh config file so that I can 'ssh <shorter name> to
connect but is there any way of adding alias 'HostName' entries?

I know I could add shorter names to /etc/hosts but this would only
work where I have root access and is less easy to manage. I have a
common/shared ssh config file that I use across most of my systems and
thus a change to that would be the nicest way to do it, if it's
possible.

--
Chris Green
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: Is there any way in the ssh config file to shorten the "hostname's password" request? [ In reply to ]
Hi,

You might try setting the HOSTALIASES environment variable to point to a file that maps short names to FQDN's. See the hostname(7) and gethostbyname(3) man pages for more detail. However, in my experience this only works if nscd is not running, and I don't know if it would address your particular use case.

--
Iain Morgan

?On 12/8/22, 06:21, "openssh-unix-dev on behalf of Chris Green" <openssh-unix-dev-bounces+iain.morgan=nasa.gov@mindrot.org on behalf of cl@isbd.net> wrote:

I have an ssh login on a hosting service where the hostname of the
system I log onto is ridiculously long:-

qnhjuc5h8w3s@sxb1plzcpnl489538.prod.sxb1.secureserver.net

So when I connect I get a very long "<name>'s password:" which I find
rather distracting, not to mention that it doesn't really tell me what
I'm logging into.

I know I can set alternative (shorter) host names by using 'Host'
sections in my ssh config file so that I can 'ssh <shorter name> to
connect but is there any way of adding alias 'HostName' entries?

I know I could add shorter names to /etc/hosts but this would only
work where I have root access and is less easy to manage. I have a
common/shared ssh config file that I use across most of my systems and
thus a change to that would be the nicest way to do it, if it's
possible.

--
Chris Green
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.mindrot.org%2Fmailman%2Flistinfo%2Fopenssh-unix-dev&amp;data=05%7C01%7Ciain.morgan%40nasa.gov%7Cc023b923605a47bb4e0308dad9278af6%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638061061111711766%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=vVuoK8Uv8195n%2FweVVUkfWaAzv6Xab0omBaX2rp9weE%3D&amp;reserved=0

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: Is there any way in the ssh config file to shorten the "hostname's password" request? [ In reply to ]
On Fri, 9 Dec 2022 at 01:23, Chris Green <cl@isbd.net> wrote:
> So when I connect I get a very long "<name>'s password:" which I find
> rather distracting, not to mention that it doesn't really tell me what
> I'm logging into.

If it's SSH "password" authentication, ssh(1) will use the
HostKeyAlias (if set) in the prompt:

$ ssh -o hostkeyalias=foobar -o preferredauthentications=password localhost
dtucker@foobar's password:

If it's SSH "keybpoard-interactive" authentication then the prompt
might be generated by PAM, and in that case there's not much ssh can
do with that.

--
Darren Tucker (dtucker at dtucker.net)
GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860 37F4 9357 ECEF 11EA A6FA (new)
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: Is there any way in the ssh config file to shorten the "hostname's password" request? [ In reply to ]
On Fri, Dec 09, 2022 at 09:46:05AM +1100, Darren Tucker wrote:
> On Fri, 9 Dec 2022 at 01:23, Chris Green <cl@isbd.net> wrote:
> > So when I connect I get a very long "<name>'s password:" which I find
> > rather distracting, not to mention that it doesn't really tell me what
> > I'm logging into.
>
> If it's SSH "password" authentication, ssh(1) will use the
> HostKeyAlias (if set) in the prompt:
>
> $ ssh -o hostkeyalias=foobar -o preferredauthentications=password localhost
> dtucker@foobar's password:
>
Brilliant, thank you, exactly what I wanted! I should have stared at
the ssh_config man page for a bit longer and I would have found it.
Although reading the entry for HostKeyAlias I might not have realised
that it does what I wanted.

Thanks again.

--
Chris Green
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev