2

On a server we have a script running some PuTTY PSCP:

pscp -v -sftp target-host:/some-path/* some-local-path

target-host is neither an IP nor and hostname like some.server.com but a single word, like an alias.

I've looked into the Windows hosts file in C:\Windows\System32\drivers\etc\ but there is no alias defined.

I've checked into the Windows registry under HKEY_CURRENT_USER\Software\SimonTatham but there is no session defined.
I've even run a full search for the name in the registry.

I've also looked for the name in all the files of the directory just in case there was some local configuration file.

But I was not able to find it.

Any idea where it could be defined?

Pragmateek
  • 151
  • 2
  • 7
  • 1
    If you run PuTTY (GUI) as the same user, do you see the stored session `target-host`? – Lenniey Dec 10 '18 at 10:45
  • I can't find any PuTTY GUI, the `PSCP` is standalone. – Pragmateek Dec 10 '18 at 10:48
  • 1
    That may be the result of one or more search domains that have been configured in the network settings under DNS options. In case of unqualified hostnames like `target-host` the search domain / search suffix `example.com` gets appended to generate a fully qualified domain name `target-host.example.com.`. Since multiple search domains can be defined that will each be attempted until one matches you may get some unexpected results. – HBruijn Dec 10 '18 at 10:48
  • @HBruijn Wow I didn't know about this feature. Unfortunately no suffixes are defined but this was a good try as I'm pretty sure that `target-host.com` is valid and the target host. Note that I can't `ping` this name directly so I don't know how to check if this kind of magic happens... – Pragmateek Dec 10 '18 at 10:58
  • Can you run the portable version of PuTTY GUI and see if the session is there? If yes, it must/should be somewhere in the registry. – Lenniey Dec 10 '18 at 11:00
  • I can't see any session in the GUI. – Pragmateek Dec 10 '18 at 13:20
  • Seems like you used another user for PSCP, obviously you won't find the sessions under `HKCU`, then. – Lenniey Dec 10 '18 at 13:45

2 Answers2

1

All PuTTY settings are stored in the registry in the case of windows, more exactly in: [HKEY_CURRENT_USER\Software\SimonTatham].

Host names, in your situation, can appear like that due to DNS server (or whatever is handling your DNS naming) bad configuration. some of the anomalies can be host-names that appear for various IP addresses even if they do not use that address anymore or that appear to have multiple IP addresses.

Just the same, a DNS server can have aliases pointing to host-names.

Overmind
  • 3,076
  • 2
  • 16
  • 25
  • As OP clearly states: _I've checked into the Windows registry under HKEY_CURRENT_USER\Software\SimonTatham but there is no session defined._ and _Note that I can't ping this name directly_ – Lenniey Dec 10 '18 at 11:36
  • And I stated that the settings cannot be anywhere else in the case of windows. And "can't ping this name directly" directly supports the DNS server bug theory. – Overmind Dec 10 '18 at 12:08
  • OK I've finally found a PuTTY session in the registry but for another user under `HKEY_USERS\S-X-X-XX-XXXXXXXXXX-XXXXXXXXX-XXXXXXXXX-XXXXXX\Software\SimonTatham\PuTTY\Sessions\target-host`. I've been mistaken by the fact two servers should have the exact same configuration, but looks like the setup has not been performed completely. :-/ I will investigate further and ensure both servers are perfectly in sync... – Pragmateek Dec 10 '18 at 13:25
  • OK, after ensuring the two machines are in sync all is running fine. :) – Pragmateek Dec 10 '18 at 15:45
1

Windows will use it's builtin name resolution, so you will not find plain strings anywhere. Its most likely stored in DNS or reachable with mDNS.

bjoster
  • 4,805
  • 5
  • 25
  • 33