Thursday, May 9, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 3805  / 3 Years ago, sat, august 7, 2021, 3:47:36

I'm trying to block site with configuring /etc/hosts file.



sudo sh -c 'echo "0.0.0.0 http://youtube.com" >> /etc/hosts'


but I still can access youtube from browser(s). even I changed the domain to 127.0.0.1 but it didn't work.


More From » hosts

 Answers
4

/etc/hosts only deals with the hostname you are accessing, not the whole web address. So to block http://youtube.com/..., you only want to specify youtube.com because that is the host.



Note that YouTube actually uses www.youtube.com (with the www) and that is considered a different hostname so you'd have to block that too.



The final thing to note is that this just blocks your ability for your DNS system to be able to look up YouTube by its hostname. It is not securely blocking YouTube, as users may be able to look up its IP addresses some other way. A determined user could do it.


[#26766] Saturday, August 7, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
peratingcit

Total Points: 253
Total Questions: 122
Total Answers: 94

Location: Botswana
Member since Sat, Jan 7, 2023
1 Year ago
;