How to edit a file owned by root?

Terminal Velocity

Well-Known Member
Joined
Oct 13, 2021
Messages
519
Reaction score
371
Credits
3,680
I want to edit the file
/etc/systemd/resolved.conf
which contains the following:
Code:
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details

[Resolve]
# Some examples of DNS servers which may be used for DNS= and FallbackDNS=:
# Cloudflare: 1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001
# Google:     8.8.8.8 8.8.4.4 2001:4860:4860::8888 2001:4860:4860::8844
# Quad9:      9.9.9.9 2620:fe::fe
#DNS=
#FallbackDNS=
#Domains=
#DNSSEC=no
#DNSOverTLS=no
#MulticastDNS=yes
#LLMNR=yes
#Cache=yes
#DNSStubListener=yes
#DNSStubListenerExtra=
#ReadEtcHosts=yes
#ResolveUnicastSingleLabel=no

I want to remove the # from the line:
#DNSOverTLS=no
and replace ''no'' with ''yes''
How I do that?
 


I usually make a backup copy of the file before editing, just in case. I use the command:
Code:
sudo cp -rp <filename> <filename>.org

I always used a ".org" extension for those pre-edit backups, but ".orig" would be better.

The "-r" means recursive. It will work on individual files but also backup directories and their files. The "-p" means to keep the original owner, group, and file dates without altering them in the backup copy.
 
Are the correct ports open on your firewall? You need to open TCP port 853 for it to work.

To test, configure your firewall to cut off regular DNS communications by blocking outbound TCP and UDP traffic to port 53 and see if DNS continues to work. You can also do as they suggest and sniff on port 853 to see whether there is encrypted DNS traffic to the servers at 9.9.9.9 or 149.112.112.112.

Do you know how to configure your firewall to open and block ports? Can you follow the tcpdump instructions on that link you provided, to sniff the port 853 traffic?
 
No sphen, I have never use a firewall before. Tomorrow I will start a new thread with proper title, I hope you came over there
 
This goes against the vague computer security dogma, but you might also want to change the permissions of the file itself. If you know what your doing, that just makes editing text files easier. You can use the "chmod" command for that and make it so that just your user login can change it.

Yet if this is just a one time thing that you're not likely to change back, then just go ahead and use sudo.
 
Wouldn't it have been easier to just have Googled what you wrote as the topic title of this thread, I'm 100% sure it has been asked more than a a thousand times all over the internet before.
 
Last edited:
Wouldn't it have been easier to just have Googled what you wrote as the topic title of this thread, I'm 100% sure it has been asked more than a a thousand times all over the internet before.
Yeah but people don't always choose the most efficient options when they have a lot on their plate. That's what I did for every permissions related. Anyone who wants to go for a little ride can research the sticky bit!
 
Yes related but not what I was looking for, and no mention about the multiple text editors that exist
I still have problems with search engines sometimes, there isn't always a solution because sometimes you don't even know about the words you're supposed to be using to find the information.
 
Terminology

It applies tp many hundreds of topics, (not just linux etc etc) and often takes on a different meaning depending on where it is used.
terminology is often used by various trades/professions/services etc to make the true meanings obscure....usually as a point where they charge higher rates to 'solve the problem'
 
I googled it and I found bad quality results compared to the Rob's answer
I find that hard to believe I already found the answer in the letmegooglethat link I posted in the first page.
Never better time than now to learn more about sudo.
And this maybe of help: https://support.google.com/websearch/answer/2466433
For example if you know a good website for Linux content you could do a search like this.
Code:
site:linuxhint.com sudo
Also it may be useful what distribution you are using because not all distributions use systemd-resolved for the dns settings.
 
I find that hard to believe I already found the answer in the letmegooglethat link I posted in the first page.
Never better time than now to learn more about sudo.
And this maybe of help: https://support.google.com/websearch/answer/2466433
For example if you know a good website for Linux content you could do a search like this.
Code:
site:linuxhint.com sudo
Also it may be useful what distribution you are using because not all distributions use systemd-resolved for the dns settings.
Well, that may be true, but rob's answer pretty much got to the point right away. Plus, we don't know exavtly what terminal velocity jammed on their keyboard to ;)
 
Code:
site:linuxhint.com sudo
Also it may be useful what distribution you are using because not all distributions use systemd-resolved for the dns settings.
Also, I think that is probably the best way to code with google, based on my experiences, you don't even have to put the "site" in there, but you do when your not on the front page of google.

For example, this does the same this as going to the google search and typing "linux.org cookies":

Code:
site:linux.org cookies

It's funny how normally i just go to the front page of google, when that method is a lot easier. There was a while when i was studying certain keywords with using google, but probably because my info was outdated...google was occasionally telling me that i might be an AI and that i needed to "verify i was human". Do you know where google regular updates how to enter commands, or if it exists?
 


Latest posts

Top