Error message in Apache log file: “Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden”

The error message "Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden" occured in my Apache logfile and the visitor was displayed an error 403 forbidden error page when trying to access a cgi-script written in Perl. The solution was to add the following for the directory in question to my Apache configuration file: 

<Directory /var/www/cgi-bin>
  <Files ~ (\.pl)>
  Options ExecCGI FollowSymLinks
  </Files>
  Options +FollowSymLinks +SymLinksIfOwnerMatch
</Directory>

 

Remmina on Ubuntu 12.04 problem to connect to Windows 7 with RDP ‘Unable to connect to RDP server’

Suddenly I couldn’t connect to my Windows 7 machine by RDP using Remmina on Ubuntu 12.04. It had worked before and suddenly stopped working. The error message displayed was ‘Unable to connect to RDP server’. Other RDP connections worked fine.

For some reason the problem was solved by editing the file ~/.freerdp/known_hosts and deleting the line with the server having the problem. When connecting again I was asked to accept the certificate and now the RDP connection worked again.

 

Err 310 ERR_TOO_MANY_REDIRECTS in Chrome and Firefox using Apache’s mod_rewrite

I used Apache’s mod_rewrite in order to direct a couple of domains pointing to the same website using the 301 moved permanently (to avoid duplicate content), i.e. something like this in .htaccess: 

RewriteEngine On
RewriteCond %{HTTP_HOST} !^example\.com$
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

I randomly got the error message 310 ERR_TOO_MANY_REDIRECTS when trying the different domains in both Chrome and Firefox (other browsers seemd to work). I had decided my site should be reached without "www", so http://www.example.com was redirected to http://example.com also. 

After a while of head scratching I found a couple of forgotten DNS entries. Two of them where outdated. My domain setup for example.com in DNS looked like this (sample IP-addresses): 

example.com zone:

@  IN  A  192.168.100.1
@  IN  A  192.168.100.2
@  IN  A  192.168.100.3

www  IN  A  192.168.100.1

But only 192.168.100.1 was valid and had a running web server on it.

I guess what happens is when Chrome/Firefox tries to talk to 192.168.100.2 or .3 and get no response, they add "www" in front of the domain name, i.e. http://www.example.com. Now it got a response from the webserver saying 301 redirect to http://example.com. Now trying to talk to example.com on 192.168.100.2 or .3 no response, adding "www" and there we have our loop.

Fixing the DNS entries (removed the invalid 192.168.100.2 and .3) fixed the problem. A bit odd and hard to find, and most of all stupid to have the outdated records still in the zone. 

 

Internal Server Error 500 when trying to install JCE 2.2.6 in Joomla 2.5

When trying to install the JCE content editor for Joomla version 2.2.6 in Joomla 2.5 it failed with HTTP Error 500 Internal Server Error. Directory permissions was not a problem and there was no problem installing other extensions. 

Solution: 

  1. Download the JCE 2.2.6 zip archive to your computer.
  2. Unzip it to a local folder, called for example "jce"
  3. Upload the folder to your Joomla! tmp directory
  4. In the Joomla! backend, go to Extensions -> Manage extensions and go to the box for installation from a folder on the server.
  5. Enter the path where the uploaded folder containing JCE is uploaded, i.e. probably something like /var/www/mysitename/web/tmp/jce and click install.

 

 

Remove or add www to URL using Apache mod_rewrite

To avoid a website being considered as "duplicate content" by Google (i.e. the same website appearing under different URLs) it is a good idea to make sure the website doesnt appear as both http://www.example.com and http://example.com. This can be achieved by using the mod_rewrite in Apache using the .htaccess file.

To remove "www" from the URL, i.e. the website’s URL should be http://example.com, your .htaccess should look like this: 

RewriteEngine On
RewriteCond %{HTTP_HOST} !^example\.com$
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

If you instead want to make sure "www" is added, i.e. the website’s URL should be http://www.example.com, your .htaccess should look like this: 

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

 

postfix only listens on localhost (127.0.0.1)

On a newly installed VPS (Parallells Virtuozzo) running Ubuntu 12.04 LTS I also installed postfix as my MTA. However, it turned out that it only listened on localhost. I checked that "inet_interfaces = all" in main.cf and that my /etc/hosts was up to date with my server’s hostname. The reason was that the machine had sendmail preinstalled and running.

A netstat -an gives: 

tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN

To the solution to this is: 

sudo /etc/init.d/sendmail stop
sudo update-rc.d -f sendmail remove
sudo /etc/init.d/postfix restart

Now netstat -anp show that postfix listens to all interfaces: 

tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 691/master

 

Avoiding a SSH client connection to timeout

If you’re behind a firewall you sometimes run into a problem where the SSH client connection times out after a period of time (typically when going out for lunch leaving your SSH sessions logged in). The easiest way to solve this is by changing the configuration of the SSH client (it can also be fixed through the server config but since the problem often relates to the firewall protecting the client it is a better solution to fix this in the client). 

Just edit the file ./ssh/config and add the lines: 

Host *
ServerAliveInterval 30

The above assumes the firewall drops inactive connections at an interval > 30 seconds. 

 

How to make a floppy file image and mounting it in Linux

To make a file image of a floppy disk in Linux (like Ubuntu), you need (of course) a computer with a floppy drive (/dev/fd0). Insert the floppy you want to copy to an image file and issue the command:

$ sudo dd bs=512 count=2880 if=/dev/fd0 of=floppy.img 

Block size (bs) and count above is for a 1,44 MB 3.5" floppy disk.

The image file can be copied back to another floppy disk with the command: 

$ sudo dd bs=512 count=2880 if=floppy.img of=/dev/fd0

The image file can also be mounted directly from the image file without the need of a physical floppy disk: 

$ sudo mkdir /media/fd
$ sudo mount -o loop floppy.img /media/fd/

I use the above method to move the content from a number of floppy disks to my hard drives. Computers today are rarely seen with a floppy drive and I wanted to secure the content before it is too late 🙂 

 

HP Compaq 6910p builtin 3G modem driver for Ubuntu

From Ubuntu 11.04 and onward there is no need for a driver to use the builtin 3G (WWAN) modem in the HP Compaq 6910p laptop computer. But by default the modem is soft blocked even though the radio lamp is on. The rfkill utility can be used to enable it:

$ rfkill list
0: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
1: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
2: hp-wifi: Wireless LAN
Soft blocked: no
Hard blocked: no
3: hp-bluetooth: Bluetooth
Soft blocked: no
Hard blocked: no
4: hp-wwan: Wireless WAN
Soft blocked: yes
Hard blocked: no

Enable it with rfkill unblock 4

$ rfkill unblock 4
$ rfkill list
0: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
1: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
2: hp-wifi: Wireless LAN
Soft blocked: no
Hard blocked: no
3: hp-bluetooth: Bluetooth
Soft blocked: no
Hard blocked: no
4: hp-wwan: Wireless WAN
Soft blocked: no
Hard blocked: no

Now click on the network manager icon in the top right bar of the screen and Activate mobile broadband and off you go!