Issue
I tried to edit my /etc/hosts file using Emacs, VSCode, etc. (with sudo, of course) and it kept saying that I did not have the permissions to edit the file.
Then I tried with Vim, Nano and Atom... and those were able to edit and save the file.
(Running echo 'some host' | sudo tee -a /etc/hosts
has also worked just fine).
So why is that? Why some editors can edit the file without any problem while others don't?
Solution
Try to open C-x C-f /sudo::/etc/hosts
with your local emacs.
Answered By - Michael Albinus Answer Checked By - Senaida (WPSolving Volunteer)