Closed robooo closed 5 years ago
Unfortunately, Linux distributions tend to have 644 permissions on /etc/hosts where only root has write access. You should be able to read it as any other user though, unless someone has changed the default permissions.
If you just want to test with a different file, you can specify a custom path:
hosts = Hosts(path='my_hosts_file')
How to deal with: PermissionError: [Errno 13] Permission denied: '/etc/hosts' when I can't change perms on hosts file? (default ubuntu setting)