Wednesday, May 15, 2024
 Popular · Latest · Hot · Upcoming
27
rated 0 times [  27] [ 0]  / answers: 1 / hits: 20478  / 2 Years ago, mon, september 5, 2022, 5:49:32

I have many servers and they all end with the same servers.company.net, so for example vded-xx-001.servers.company.net, and was wondering if it is possible to make it so i can just type the vded-xx-001 and have it append the servers.company.net automatically ?



So i would want to type



ssh user@vded-xx-001


and have it actually connect to



ssh [email protected]


I have tried setting my DNS-search domain to servers.company.net, in /etc/network/interfaces, but this did not achieve the desired outcome.



Anyone able to point me in the right direction ?



Thanks in advance


More From » networking

 Answers
4

Probably you already solved this, but maybe later it could help someone: you don't need to mess with your resolv.conf, just can use something like this in your ~/.ssh/config:



Host vded-*-001 test-*-something-fixed-*
HostName %h.servers.company.net
User someusername


So later you can just use:



ssh vded-alotofstuff-001
ssh vded-somethingels-001
ssh test-02-something-fixed-somethingelse

[#31738] Monday, September 5, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
entmpy

Total Points: 52
Total Questions: 112
Total Answers: 113

Location: Marshall Islands
Member since Tue, Sep 21, 2021
3 Years ago
;