6
/etc/hosts
lets you set system-wide hostname lookups. Is there a place in OS X to set per-user hostnames?
I use two user accounts on my laptop and I'd like to override IP addresses for just one of those accounts. Is that possible?
6
/etc/hosts
lets you set system-wide hostname lookups. Is there a place in OS X to set per-user hostnames?
I use two user accounts on my laptop and I'd like to override IP addresses for just one of those accounts. Is that possible?
6
No, DNS is global.
You don't mention any details.
You could redefine:
thissite.com 0.0.0.0
mythissite.com 122.122.122.122 <-- with the IP address of the real site.
Then only people who know that thissite.com is broken and to use mythissinte.com instead would be able to access thissite.com
2As a note this will only work if the site you are masking with a new domain name is listening on that domain, otherwise it may say "nope! I don't know who mythissite.com is!" And return a 404 error – Mark Henderson – 2014-11-26T22:03:19.553
1To further clarify what Mark is saying, if a server is using Apache virtual hosts the setup is not really IP address based but rather hostname based. When I setup Apache servers I specifically "dead end" direct IP address calls to a blank page. Only valid host names as well as configs on the Apache sever will result in real content being returned. – JakeGould – 2014-11-27T07:37:38.783
2
There is no such thing in any operating system, but you can swap /etc/hosts
file by some script when user is logging in.
I don't know much about OS X, you may have to restart one or more network services after that file swap.
You also might want to change permissions or owner on /etc/hosts
file, if your script will be running from non-administrator account.
Pretty sure ubuntu has a ~/.hosts – wTyeRogers – 2018-12-21T22:42:29.910
@Tetsujin this is incorrect. Yosemite or any older versions of OSX, as well as any Linux and FreeBSD distributions that I know of, works with /etc/hosts. – Umur Kontacı – 2014-11-27T03:43:40.047
@Tetsujin first page of your google search result not confirming your claim and contain question about hosts file
– Ivan Solntsev – 2014-11-27T09:33:19.690