Mount CIFS / SMB filesystem on AIX

Intro

These instructions explain how to mount a filesystem exported from windows or a server running Samba on to a AIX server, this is the client side setup, not how to set up an AIX server to export a UNIX filesystem to windows.

The AIX server needs the following package:-

bash-3.00# lslpp -l | grep cifs
  bos.cifs_fs.rte            6.1.2.0  COMMITTED  Runtime for SMBFS

If you need to install it, mount b0045nim.brm.pri:/export/nim/lppsource to somewhere like /mnt/b0045nim and cd to /mnt/b0045nim/aixv61/installp/ppc (for AIX6.1). You can see the available cifs packages with:-

bash-3.00# ls | grep cifs
bos.cifs_fs.6.1.0.0.I
bos.cifs_fs.6.1.1.0.I
bos.cifs_fs.rte.6.1.2.0.U

Method

Mounting a cifs filesystem is a 2 stage process. The access credentials need to be saved in /etc/cifs_fs/cifscred. This allows the stored credentials to store a password more securely than in /etc/filesystems which is world readable:-

bash-3.00# ls -l /etc/filesystems 
-rw-rw-r--    1 root     system         9933 28 Jul 2009  /etc/filesystems

bash-3.00# ls -l /etc/cifs_fs/cifscred
-rw-rw----    1 root     system            0 05 Jan 2007  /etc/cifs_fs/cifscred

Using fqdn's for the server names avoids having to have hosts file entries for addm servers. Without the fqdn or a hosts entry, this will not work:-

This won't work from a unix.brm.pri server:-

bash-3.00# nslookup svcedap27

** server can't find svcedap27: NXDOMAIN

But this will:-

bash-3.00# nslookup svcedap27.addm.ads.brm.pri

Non-authoritative answer:
Name:   svcedap27.addm.ads.brm.pri
Address: 10.85.65.98

Create mount credentials

Use the mkcifscred command to do this:-

bash-3.00# mkcifscred -h server01.addm.ads.brm.pri -u username -p topsecretpassword
bash-3.00# 

Use mkcifscred, chcifcred, rmcifcred, and lscifcred to maniplulate the credentials:-

bash-3.00# lscifscred 
server: server01.addm.ads.brm.pri user: username

bash-3.00# rmcifscred -h svlrcns01.addm.ads.brm.pri -u beataccess

Mount the shared directory

Mount the remote cifs filesystem with mkcifsmnt, specify the unix owner of the mounted filesystem with -u UID and -g GID. Annoyingly, these seem to have to be the UID and GID not the username and groupname.

bash-3.00# mkcifsmnt -A -f /mount/point -h server.addm.ads.brm.pri -d cifsshare -c username -w domain-wrkgrp-server -u 400 -g 400
  
bash-3.00# mount | grep beat
svcedap27.addm.ads.brm.pri beat             /oracle/beat/db01/ftptest2 cifs   10 May 14:25 wrkgrp=svcedap27

This adds a stanza to /etc/filesystems:-

/oracle/beat/db01/ftptest2:
        dev             = beat
        vfs             = cifs
        nodename        = svcedap27.addm.ads.brm.pri/beataccess
        mount           = true
        options         = w,uid=400,gid=400,fmode=755,wrkgrp=svcedap27
        account         = false

Quick Crib

bash-3.00# mkcifscred -h server27.addm.ads.brm.pri -u username -p password

bash-3.00# lscifscred
server: server27.addm.ads.brm.pri user: username

bash-3.00# pwd
/oracle/beac/db01

bash-3.00# ls -l
total 43546888
drwxr-xr-x    2 root     system          256 10 May 15:17 ftpdev2

bash-3.00# mkcifsmnt -A -f /oracle/beac/db01/ftpdev2 -h server27.addm.ads.brm.pri -d beac -c username -w server27
bash-3.00# mount | grep beac
         /dev/beaclv      /oracle/beac     jfs2   22 Dec 13:06 rw,log=/dev/beaclog
         /dev/beacredoalv /oracle/beac/redoa jfs2   22 Dec 13:06 rw,cio,log=/dev/beaclog
         /dev/beacredoblv /oracle/beac/redob jfs2   22 Dec 13:06 rw,cio,log=/dev/beaclog
         /dev/beacarchlv  /oracle/beac/archlogs jfs2   22 Dec 13:06 rw,log=/dev/beaclog
         /dev/beacdata1lv /oracle/beac/db01 jfs2   22 Dec 13:06 rw,cio,log=/dev/beaclog
svlrcns01 /vol/Beac        /oracle/beac/db01/ftpdev nfs3   22 Dec 13:06 rw              
server27.addm.ads.brm.pri beac             /oracle/beac/db01/ftpdev2 cifs   10 May 15:33 wrkgrp=server27

Limitations

It seems that after a umount or reboot, mount -a does not remount the filesystem even if the filesystem is listed in /etc/filesystems. Use:-

bash-3.00# chcifsmnt -f /mount/point
 
aix/aix_cifs-client-mount.txt · Last modified: 06/04/2022 00:23 by andrew