Friday, November 6, 2009

Quick start with the HP-UX CIFS Client

I've been slowly migrating web servers from IIS over the years to HP-UX Web Server Suite to benefit from increased PHP performance, and a need has come up to access data stored on a Windows share.

The HP-UX CIFS Client is an OEMed version of Objective Development GmbH's Sharity which is a software that lets you mount Windows shares on a variety of platforms. I don't know the specifics but it used to be a userland tool, and HP has extended it to to make it a kernel module. The engineer in charge of the CIFS client actually posts once in a while in the ITRC forum.

The CIFS client is already built in the default 11.31 installation, so there is no need to install it. It is very easy to use. It uses a clever hack to manage who owns files in the CIFS mount: your users log on independently to the CIFS server, and will be able to see the whole filesystem as their own.

In a nutshell, here is how to mount a CIFS share. Your HP-UX box doesn't have to be in a domain.

1. Obtain from your Windows admin a login/password to an account authorized to use the share

2. Activate the CIFS client
# vi /etc/rc.config.d/cifsclient
RUN_CIFSCLIENT=1
# /sbin/init.d/cifsclient start

3. Create a mountpoint and mount it
# mkdir -p /cifs/myshare
# mount -F cifs myserver:/myshare /cifs/myshare

At this step, the filesystem is mounted but it is not possible to access it. You first need to have a UNIX user log in to the CIFS Server using cifslogin, then access to the share will be possible. You can do this as root but it is better to use an unprivileged standard user.

4. Log in to the CIFS server as an unprivileged user
# su - user
user$ cifslogin -U winuser -P winpassword myserver

5. Save the user credentials in the CIFS datbase so they can be reused automatically next time:
user$ cifsdb myserver

6. Return to root and save the share the CIFS database so it can mount automatically next time:
# cifsdb /cifs/clsweb_donnees

This should enable the share to remain mounted across reboots. It is also supposed to work if the Windows server reboots but I have not tested it yet. Those of you who would prefer to use the automounter to mount shares dynamically can also do so, which can be useful if you have a bunch of home directories to take care of.

O.

2 comments:

Unknown said...

thanks a lot sir, this helped.

Unknown said...
This comment has been removed by the author.