Wednesday, August 26, 2009

Unlock button greyed out in Ubuntu menu with remote SSH VNC Connection

After I setup a Ubuntu server somewhere, I decided to use VNC via SSH tunnel for getting its nice GUI back. However, each time I click to open Program from menu item, the "Unlock" button is always greyed out. After googling for a few articles about this, I found a solution which was working on Hardy server. Amazingly, it works on Jaunty server as well!

1. After I logon with SSH client and open VNC client sucessfully. I type this in terminal window:



Then the polkit-authorization dialog box appears.

2. In the left pane, navigate to freedesktop->systemtoolsbackends->Manage System Configuration. In the right pane, click "Edit" button under Implicit Authorizations. Edit Implicit Authorizations dialog box will appear.

3. In Edit Implicit Authorizations dialog box, assgin Anyone with Admin Authentication.

4. Click Modify button to confirm and then Close button to exit.

5. Reboot the server and try login again via SSH and then open VNC client to come back to GUI environment.

Now any dialog from menu item with Unlock button should be enabled again and you will be authenticated when clicking Unlock button.

Monday, August 17, 2009

PHP Sendmail problem on Ubuntu

For most general PHP functions like mail(), XAMPP package always works well on Win32 platform with its pre-defined settings. For linux distro like Ubuntu, you need to do extra steps to make it work.

1. You must be sure that you have run the following commands:



2. Come to your php.ini and edit like this (you'd better search php.ini yourself by issuing 'locate' command):



3. One extra thing to fix unqualified host name issue with error message like 'unable to qualify my own domain name'. Open and edit /etc/hosts as follows:

Let's say you have your machine locally named 'yourserver', add it with postfix '.local'

127.0.0.1 yourserver.local localhost

4. Restart Apache server or your LAMPP server to make PHP settings effective.

Now your PHP code should work on using mail() function for sending email message out.

Tuesday, August 11, 2009

Let Apache as a internet gateway to other intranet servers

To secure the web services and maintain high availability, it is good to have a proxy in front of the other web application servers which sit inside the intranet. You can imagine there is only one IP address available and one physical machine. How can I setup multiple servers at a time? Using VMware makes my dream come true;)

Inspired by an article about setting gateway server for Internet users accessing intranet resources like Outlook Web Access service, I get this good thing work on my machine.

With one front-end gateway with ability to be accessed by Internet users, we can implement reverse proxy which redirects particular web requests to internal servers. The gateway server should have Apache server equipped and ready to run. What you need to do on the machine would be adding a few lines to the configuration file like, httpd-ssl.conf. This file contains settings for general Apache HTTPS request handling. I assume you have your SSL certificate sitting well in the gateway machine. For the rest, just a few lines in the configuration file like httpd-ssl.conf:

Within the block of VirtualHost
(possibly something like VirtualHost _default_:443):



SSL certificate will sit inside the gateway server and serve HTTPS requests for other intranet servers. In this case, we only need one SSL certificate for all internal servers.

Download faster with enhanced apt-get

Yes, right. System update could take longer and longer time without using this gadget. On Ubuntu, traditional package installer apt-get is great but requires something else to make downloading faster. Axel is one of the best candidate and which is also free to download and install.

To install axel at first, type this:



There is a sample script to combine the power of apt-get and axel.

Just copy and paste the script into a text file, name it ("apt-fast", whatever) and then place it into a directory like /usr/bin/ and make it available for use with the following command:



Then you can use it like apt-get command and enjoy the high speed downloading than ever before.

Good tool, indeed!

Monday, August 10, 2009

Start vnc4server automatically on Ubuntu bootup

Nice to find an article talking about how to deal with vnc4server on Xubuntu, especially for auto startup. With my imagination, now it's for Ubuntu use as well;>

Making vnc4server start automatically

You can make your vnc4server start automatically with a simple one-line script.


Paste the following into the script editing the resolution to your liking:



Now save the file and exit nano. You'll also need to make the file an executable, do so with the following command:


Finally, to have this script run automatically, simply add it to your startup group:


To remove it from your startup list, do this:


For Gnome user, better do this:

Tuesday, August 4, 2009

Add MySQL Authentication feature to Apache2 on Ubuntu

mod_auth_mysql is said to have served the web community pretty well along the time and most developers, even though not all of them, find it useful and love it. I can see the complaints about this module as the development of Apache server keeps going. In terms of security and management, using MySQL as a permanent store for user accounts is better than using plain text file. As long as the way to carry out web authentication is shifted from traditional pop-up browser window, to Application Server's own session control, it is still valuable to retain such usage for MySQL Authentication. As new version of XAMPP package comes out, the mod_auth_mysql module seems to be missed out. Actually, you need to build one yourself. Of course, I assume you are using Ubuntu.

An article from Europe may help building DSO module ourselves. Just download the right stuff, patch it, build it and install it.

Something else need to be done according to the linked article, mostly likely a little change in .htaccess under the protected directory.

Another article aims at clarifying the usage and configuration of mod_auth_mysql module in .htaccess file. Very useful! I have missed out some parameters mentioned there and couldn't make the authentication work on Ubuntu.

For .htacess, I do have the following comments:

To eliminate any unnecessary complaints from Apache itself, add the following line first:
AuthUserFile /dev/null

However, some articles point out that the following line should be COMMENTED OUT, especially for Apache2.X:
#AuthGroupFile /dev/null

When using mod_auth_mysql, it is a must to tell Apache which MySQL socket be used. Otherwise, you may receive complaint like:
MySQL ERROR: Can't connect to local MySQL server through socket '...'
MySQL user ... not found:...


This problem can be solved by adding the following line:

AuthMySQLSocket "full/path/to/mysql.sock"

This helps Apache finding the right MySQL socket for successful connections.

It seems that we'd better declare everything whether it is default or not. This will help identifying any problem in the configuration.

LAMPP Autostart on Ubuntu

More and more people start to use Linux and one of the most popular distribution is Ubuntu. People like me are fantastic about setting up virtual appliance with Ubuntu. Turn it on and run!
However, we need to have more sophisticated control over the services. To make the service started itself when the appliance is turned on, we need some tricks. Thanks to the reference article.

Let's say we are going to make LAMPP server up when the appliance is turned on. We can do it by typing something like this:



Ubuntu is a bit different in managing the services than Debian distro. It's worth to learn more about this excellent platform.

Cheers!