mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
commit
690e46cc94
@ -1,44 +0,0 @@
|
||||
乌龙茶占坑
|
||||
How To Block A Website In Ubuntu
|
||||
================================================================================
|
||||
![](http://180016988.r.cdn77.net/wp-content/uploads/2014/02/block-websites.jpg)
|
||||
|
||||
Dear **ubuntu** geeks,
|
||||
|
||||
In this tutorial I will teach you how to block unwanted websites in Ubuntu Linux by editing the **/etc/hosts** file which is used to handle DNS and internet on Linux based systems.
|
||||
|
||||
I like very much this method because I don’t need to rely on third party applications and it is extremely easy to use. All you need to do is to make a simple change in the **/etc/hosts** file.
|
||||
|
||||
Make sure to have superuser access on the machine you are using this method, because the **/etc/hosts** file is owned by the root user and so it cannot not be edited by everyone.
|
||||
|
||||
What do you need to edit the **/etc/hosts** file?
|
||||
|
||||
root permissions and a text editor.
|
||||
|
||||
For this tutorial I will use my favourite text editor, vim. Ok guys, open a new terminal (**CTRL+ALT+T**) and run the following command to open the /etc/hosts file for editing.
|
||||
|
||||
vim /etc/hosts
|
||||
|
||||
Then add the following line.
|
||||
|
||||
127.0.0.1 domain.com
|
||||
|
||||
Replace the domain.com with the website you want to block and after you have finished the editing process, save the file and quit.
|
||||
|
||||
Now it is time to test if the method has worked or not. Try to access the website you blocked.
|
||||
|
||||
My cousin is addicted to the facebook social network so every time he find my laptop, he opens it and goes to facebook.com to chat with his friends.
|
||||
|
||||
What should I do?
|
||||
|
||||
I edit the **/etc/hosts** file and act like the website he is trying to reach is down.
|
||||
|
||||
You can also use this method to protect kids from adult content on the internet such as porn and horror movies.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.unixmen.com/block-website-ubuntu/
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
43
translated/How To Block A Website In Ubuntu.md
Normal file
43
translated/How To Block A Website In Ubuntu.md
Normal file
@ -0,0 +1,43 @@
|
||||
如何在Ubuntu中屏蔽一个网站
|
||||
================================================================================
|
||||
![](http://180016988.r.cdn77.net/wp-content/uploads/2014/02/block-websites.jpg)
|
||||
|
||||
亲爱的**ubuntu**极客们,
|
||||
|
||||
在本教程中我将教你如何通过编辑**/etc/hosts**文件来屏蔽在Ubuntu Linux上不受欢迎的网站,这是用来处理DNS和Linux网络的系统文件。
|
||||
|
||||
我很喜欢这种方法,因为我不需要依靠第三方应用程序,这是非常容易使用的。您需要做的就是在**/etc/hosts文件**文件中做一个简单的变化。
|
||||
|
||||
请确保您有使用此方法时在机器上处于root用户访问状态,因为**/etc/hosts文件**文件由root用户拥有的,所以它不能被不被普通用户编辑。
|
||||
|
||||
你需要在**/etc/hosts**文件中编辑什么那?
|
||||
|
||||
root权限和一个文本编辑器。
|
||||
|
||||
在本教程中我将用我喜欢的文本编辑器,vim。好了,打开一个新的终端(**CTRL+ALT+T**),然后运行下面的命令来打开/etc/hosts文件进行编辑。
|
||||
|
||||
vim /etc/hosts
|
||||
|
||||
添加下面这行
|
||||
|
||||
127.0.0.1 domain.com
|
||||
|
||||
更换domain.com为你要屏蔽的网站,你完成了编辑处理后,保存该文件并退出。
|
||||
|
||||
现在是时候来测试该方法是否成功了。尝试访问你屏蔽的网站。
|
||||
|
||||
我的表弟是沉迷于Facebook的社交网络,每次他发现我的笔记本电脑的时候,他就打开它,并去facebook.com陪陪他的朋友。
|
||||
|
||||
我应该怎么做那?
|
||||
|
||||
我编辑**/etc/hosts**文件,这样他想访问的网站就像已关闭了一样。
|
||||
|
||||
您也可以使用这个方法来保护孩子免受互联网成人内容的危害,如色情和恐怖电影。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.unixmen.com/block-website-ubuntu/
|
||||
|
||||
译者:[乌龙茶](https://github.com/yechunxiao19) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
Loading…
Reference in New Issue
Block a user