Archive for October, 2007

setup postfix as a dumb mail forwarder

Sunday, October 7th, 2007
In my Ubuntu box, I find it useful to run postfix in my computer and send my mail using localhost as SMTP instead of directly connecting to my ISP's SMTP servers. This way, large mail messages are rapidly delivered from Thunderbird to the local SMTP, and then the local SMTP relays the mail to the real SMTP (which takes longer but that's ok since I don't have to wait).

One easy way to do so is to install postfix as a Satellite System. The means that postfix will relay all outgoing mail to another SMTP server (usually provided by your ISP). First install postfix in your computer:

apt-get install postfix

Eventually you will be presented a screen in which you have to configure postfix. First you will be asked to choose General type of mail configuration. Choose Satellite System.

Then you will be asked for System mail name. You may enter your ISP's domain name here, but since you are going to set up postfix for outgoing mail relay only, it is safe just to leave your host's name.

Next you will be asked to enter SMTP relay host. At this point you specify the host that all your outgoing mail will be relayed to. This is the SMTP server provided by your ISP. Make sure you don't misspell the host's name.

Once finished with the configuration of postfix, your local SMTP should be up and running and waiting for connections. Now go to your mail application (preferably Mozilla Thunderbird) and configure your mail account to use localhost as your outgoing mail server.

Please note that if you have been using secure connections (like TLS or SSL) between your computer and your ISP's SMTP server so far, you will have to do some extra work to establish secure connectivity between your local postfix and your ISP's SMTP server.

access denied connecting to mysql from tomcat webapp

Sunday, October 7th, 2007
If you are getting an AccessControlException when you try to connect to MySQL (or somewhere else) from your web application in a freshly installed Tomcat server, it's probably because Tomcat does not allow your web apps to open socket connections, out of the box.

This is the error message in my case:

com.mysql.jdbc.CommunicationsException:
Communications link failure due to underlying exception:
java.security.AccessControlException: access denied
(java.net.SocketPermission localhost resolve)
...
at java.sql.DriverManager.
getConnection(DriverManager.java:185)


That happens because Tomcat does not allow the application to connect to MySQL. To overcome this you have to explicitly tell Tomcat to allow connection to the MySQL host, in my case the MySQL was in the same host, so I had to add the following lines in my /etc/tomcat5/policy.d/04webapps.policy:

permission java.net.SocketPermission "localhost", "resolve";
permission java.net.SocketPermission "127.0.0.1:3306", "connect";


You may need to change these values to meet your configuration's needs.

It is also possible (though, not recommended) to tell Tomcat to never deny access to your web applications, for any reason. Simply add the following line in your Tomcat's webapps policy file:

permission java.security.AllPermission;

Please note that for your changes to take effect you have to restart Tomcat:

sudo /etc/init.d/tomcat5 restart

The above have been tested and seem to work in Ubuntu 6.06LTS (Dapper Drake) Server.

enable remote access to your Windows XP

Thursday, October 4th, 2007
If you want to allow others to remotely connect to your Windows XP box through Remote Desktop Connection (or any other Terminal Services client), this is how you do it.

First you have to enable the Terminal Services service in your computer. Go to My Computer (right click) Manage Services and Applications Services. Find the service by the name Terminal Services and start it. If you want the service to automatically start every time your turn on your computer, change the Startup Type to Automatically.

Then you will have to go to My Computer Properties Remote and check the Allow users to connect remotely on this computer checkbox. That's all folks!

shared clipboard with terminal server client on ubuntu

Thursday, October 4th, 2007

If you use the Terminal Server Client to connect to a Windows host (like Windows 2000 server or Windows XP) you may experience problems copying from local host and pasting to the remote host, and vice versa. The most likely is that you use the wrong connection protocol. Make sure that you set RDPv5 in Protocol:

terminal server client login screen


This fixed the clipboard sharing between my Ubuntu and a Windows 2000 Advanced Server. You have nothing to lose if you try it too.