Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

friends, I am an Ubuntu 12.04 user and i want to any user can't send email from gmail in my pc, because they sending abuse mails from their gmail account but sending from my pc. So, please help me and suggest the right way.

share|improve this question
Maybe your Router can block gmail (the Website, not the mails) but I think the best way is to secure your PC with a password and lock the desktop when you're not at the pc. – prophecy201 Jun 17 '13 at 11:50

One method to prevent any access to is to reroute it in your hosts file. This will redirect any requests to to resolve to your local machine and not the external internet.

The method is reversible, so that you can toggle the setting when you need to use Gmail yourself.

  • Edit the file located at /etc/hosts
  • Add 2 new lines as below:

  • Save and close the file
  • Restart the networking service by running the following in your terminal:

sudo service networking restart

If you now try to access in your browser, you will find it does not load.

To disable this routing rule, so that you can access Gmail yourself, follow the same directions as above, but simply prefix the custom rules you added previously with a # character as below:


Adding or removing the # character at the front of those lines will then enable or disable the blocking of Gmail. The same technique may be used for any other domains you want to block access to.

*help on editing your hosts file in Ubuntu and other OS's may be found here

share|improve this answer
Also add, as is just redirecting... – gertvdijk Jun 17 '13 at 12:17
Thanks gertvdijk, updated – Leon Stafford Jun 17 '13 at 12:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.