Sample Header Ad - 728x90

How I alias a hostname without root access vis-a-vis gethostbyname?

1 vote
2 answers
303 views
I'm running a program which does (in its source code):
gethostbyname("whatever");
and I want it to use the local machine's address instead. I can't change the source. If I were root, it would be easy-peasy - I would just alias this name in /etc/hosts. But - is there something I can do as a _non_host_ user for the same effect on my gethostbyname() call? /etc/nsswitch.conf has:
hosts:      files nis dns myhostname
in case it matters.
Asked by einpoklum (10753 rep)
Apr 16, 2023, 06:52 PM
Last activity: Apr 17, 2023, 05:57 AM