samba mount with accent support

I'm still coding my extjs explorer and another issue I had is that I wanted to browse directory that are mounted windows shares (windows 2003 server).

As I'm french, and i've some files with accent, and with the default e-smith configuration, the accent are not displayed properly.

Here is what I did to have accent displayed properly :
  • First you need to configure the linux box to properly display accents.
This is done through /etc/sysconfig/i18n configuration file.

The e-smith is configured with the en_US charset (which means no accents ;) ) :

Here is what I put in the configuration file :

LANG="fr_FR@euro"
SUPPORTED="fr_Fr@euro:fr_FR:fr"
SYSFONT="lat0-sun16"
SYSFONTACM="iso15"


If you use a different charset that fr_FR, you should set the correct value for your language.

Notice that for this file, the e-smith template system does not use the berkley database (db set-prop) but the file itself as for fstab file.

Once you've updated the file, you need to reboot the system (maybe you can update the system with another way, but I didn't find how...)

  • Then we need to mount the share properly to get accent with the right charset. It's a client configuration issue (ie smbmount) and not a samba server configuration issue (/etc/samba/smb.conf)
mount.cifs //10.0.0.97/data           /mnt/nfs/data        -o codepage=cp850,iocharset=iso8859-1,credentials=/root/.smbcredentials
2 things are important here :
  1. cifs is Common Internet File System, a file system that support accents.

    Notice that with smbmount the time to mount a windows share is significantly longer (on my box) and displays some warning :

    5157: session request to 10.0.0.97 failed (Called name not present)
    5157: session request to 10 failed (Called name not present)

    Whereas with mount.cifs, the share are mounted instantaneously with no warning

  2. codepage=cp850,iocharset=iso8859-1

    This specify the charset used to get data from the windows share.

Notice the handy option :
credentials=/root/.smbcredentials
This allow to specify a file with windows username & password to mount the share without manually enter the credentials inforamtions.

The file should be formatted this way :

username=windowsLogin
password=windowsPassword

Now you should see the accent properly.


You can have the windows share mounted at boot time with the following line added in your /etc/fstab :

//file-server/data       /mnt/nfs/data          cifs    defaults,file_mode=0777,dir_mode=0777,codepage=cp850,iocharset=iso8859-1,credentials=/root/.smbcredentials 0 0


But for now, i've some issues :

  1. despite mount -a, mount all windows shares declared in /etc/fstab, shares are not mounted at boot time
  2. I got a kernel panic when i shutdown the linux box when the shares are unmounted... great ;)

Comments

Popular posts from this blog

Upgrade Slimframework v3 to v4, how I did it

Reset Bacula database and files

Limit the upload bandwidth of your apache webserver with mod_bw