Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I work at a big company with its own domain, and I SSH into servers every day, many times a day. Is it possible to simply type hostname instead of hostname.my.domain.com and still SSH successfully?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

You can configure a search domain for DNS. (Not specifically for puTTY, but for all programs doing a DNS lookup).

How you do that depends on your OS.

For most unix like environments:

Open /etc/resolv.conf and a a search mydomain.tld.
You can add multiple search domains.

For windows

  • For windows: Go to control panel,
  • Network and sharing center,
  • select your LAN connection, then [Properties]
  • Select TCP/IP v4, then [properties
  • Go to [advanced]
  • tab "DNS". Add the search domain.

enter image description here

For any OS configured to use DHCP

Any big company should be using a DHCP server. That can supply not just IP leases, but also DNS server names and which paths to search. This assumes you have control over these. If not, ask IT to add your own domain.


Whenever you now try to resolve a hostname the resolver will not only try to resolve the hostname, but also hostname.my.omain.tld. This will work for anything which uses DNS (e.g. puTTY, Firefox, ...)

Hopefully needless to say, but replace 'my.domain.tld' with your actual domain name.

share|improve this answer
add comment

Just adding an entry to your hosts file should be sufficient. You'll need to know the IP address of the remote server -- you can find that out by running a ping on the full hostname.

  1. Log into your Windows computer as an administrator.
  2. Open up Notepad with administrative privileges. On Vista and later, it should be sufficient to click Start, type notepad, and hit Ctrl-Shift-Enter, or right-click the Notepad icon and select Run as administrator.
  3. With your administrator Notepad, find the file C:\Windows\System32\Drivers\etc\hosts.
  4. To the end of this file, add a line with an entry like the following: 208.88.72.142 hostname where the IP and hostname are replaced with those of the server you want to connect to.
  5. Save and close. It should work immediately.

You can also set your DNS search path to include my.domain.com (which your IT administrator should arguably have done) -- bring up the properties for your network adapter by whatever means are appropriate for your version of Windows, then bring up the properties for the "Internet Protocol (TCP/IP)" entry, then Advanced, then on the DNS tab enter "my.domain.com" under "Append these DNS suffixes".

share|improve this answer
2  
What if company changes its IP frequently... There's a reason why company didn't share IP directly. –  Sachin Shekhar Mar 25 '13 at 15:40
    
Then that's what the second half of the answer is for (as unlikely as it is that the poster's company is changing the IPs of servers at all frequently...) –  tgies Mar 25 '13 at 15:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.