Apache and charset

Today, while viewing statistics for my blog, I noticed one interesting search query: \”Apache russian charset\”. Although it seems that I have never covered this issue in my blog, I had experienced this problem some time ago.

The idea is that some sites do not have a meta tag telling the browser which charset to use. This is getting really painful with russian since there are few (and I would say many) charsets for russian. As far as I know, when the browser do not see the meta tag for charset it takes a header given by apache to guess the encoding, but this is not correct in some cases as well. For instance if my server defaults to utf-8 and one of the virtual hosts (which I gave to my friend uses cp-1251) then there is a trouble (unless the browser is very inteligent to guess from the actuall page content). In this case, you can override the default charset for each virtual host by giving the AddDefaultCharset in the VirtualHost directive or by writing the same directive in the .htaccess file of the virtual host docuement root (for this the AllowOverride directive should be set correctly).

I had this problem when I gave a virtual host to my friend, but he was composing his HTML files on his home workstation (which had cp-1251 as a default charset for any saved files) and then was using FTP to upload the stuff.

Samba 2.x to 3.x on different server

Today I spent half day on trying to migrate samba 2.x from one machine to samba 3.x on another machine. Samba was also acting as an NT4 PDC with some machine members and use accounts. A bit of googling around gave me a lot of tips on completing the task as well as some possible troubles.

Some tries and I figured out the way:

1. Migrate the server:

– stop the old server

– copy /etc/* and /var/cache/samba/* to the new machine

– add user accounts and groups to /etc/passwd, /etc/shadow, /etc/group and /etc/gshadow

testparm on new machine to remove all obsolete config directives

– adjust the config (change the paths and other stuff)

– copy the files from old server to new one

– start samba on new server

2. Migrate clients:

– remove client from the domain to workgroup using the administrative account from the old domain (it is cached so will work even with old samba server offline)

– join new domain with new administrative account

No user migration is needed since all the samba files are transfered on the new server and user SIDs as well as server SID remains the same. The only thing I needed to do is to disconnected all mapped drives so that they connect back from new server at next login, otherwise clients will use cached information about mapped drives and will try to connect them from the old server.

Stats are nice

After I have set up a webalizer and checked out the stats I was very impressed. For the past 3 days (the time after downtime) I found a lot of visits and hits. But more interesting was a page with search engine queries references. I found 18 of those. Most of them are regarding 4 issues:

1. Fedora Core 4 installation:

– VNC installation questions. This is described in installation guide with all details and I was covering in my blog the successfull installation over VNC which I personally did.

– Install bootloader bug which caused kernel panic in most of the cases. This can be overcomed with typing some crap in bootloader prompt to force simple error and then giving the correct boot options (or just pressing enter)

2. Integration of Kontact and M$ Exchange + M$ Active Directory. This was covered in my blog to too far ago in all details and there is a bunch of information on the web since this is an old issue and many people did this.

3. Mounting Windows Server 2003 shares in Fedora Core 4. I also discussed this some time ago and pointed out that the main thing to do is to specify cifs as a filesystem type instead of smbfs. Check out man mount and man mount.cifs. This will not work on old distros (such as RedHat 6.2) unless kernel was compiled with cifs support (which is by default not)

4. Sony Ericsson p800/900/910 software. Previously I showed what software I run on my p910 and also pointed on some web-sites where one can find lots of stuff. My favourite is http://p800stuff.com

This seems to be it. I think that I will be covering some issues from the search engine queries referals here so that people can find more information they need ;)

What you do if you don\’t want to?

It happen to me few times that people whom I helped in the past start calling me after long time passed and asking to do some work for them. They do it the way that I start feeling like I have no choice and that it is a kind of my duty to help them again. On the other hand, there are many reasons why sometimes I do not want to come back to some people and do any kind of job for them.

So the question is what you do in such cases, because if I reject to help, I will feel somehow a bit uncomfortable and by my nature I hate rejecting to help, on the other hand, I am totally not in the mood doing any kind of job with some people even again :(

It\’s like to help or not to help :)

P.S.: please do not the case above to be global. It rarely happens that I am not willing to help someone ;-) Otherwise I would just right here something like \”Do not even bother to ask me\” ;)

Apache 2 and mod_auth_pam

I\’ve been fighting today with Apache2 and mod_auth_pam which didn\’t want to go well with me. Finally I found this nice post which gave me almost full solution. The only thing to do is to give apache somehow access to read /etc/shadow (for example by chgrp apache /etc/shadow && chmod g+r /etc/shadow).

If you have some better ideas on how to make apache 2 to authorize system users, you are welcome :)