I need to override DNS for a few hostnames on a Linux Centos 7 machine. I do not have write access to the file, however. What can I do in this case?
Asked
Active
Viewed 564 times
0
1 Answers
0
Do you have access to change the DNS server locally, with dhcpcd or other? If not, and if you don't have r/w access to /etc
, then there's nothing you can do for dns host mapping on the local host short of finding a privilege escalation vector to accomplish it.
You could however go upstream to the next dns server and make your changes there.
Or, depending on your needs, maybe setting an environment variable for the shell is enough, such as:
export google="172.217.15.110"
# and then subsequently commands like the following will work,
vimb $google
ping $google
nmap $google
... etc

GoofyEscape
- 42
/etc/
? Can you run a local DNS server/proxy? Can you override the DHCP server for this machine? Can you start the application(s) that need those DNS? If your situation is "I don't have root rights, I can't change the VM configuration, I am just a simple user" there won't be much you can do... – dirkt Apr 26 '20 at 06:44