Automounting Windows Shares with CIFS

Create an /etc/auto.master file with your automount entries, for example:

/home /etc/auto.home --timeout=600 # entries in /etc/auto.home mount to /home

/log /etc/auto.log --timeout=600
/apps /etc/auto.apps --timeout=600

Create an /etc/smbmounts/servername auth file= o ns = "urn:schemas-microsoft-com:office:office" />

username=winusername

password=winpassword

domain=windomain

Create /etc/auto.home /etc/auto.log and /etc/auto.apps or whatever you like based upon your requirements using the format below:

CIFS format of auto.parentfoldername i.e. auto.home to access via /home/unixmountname

uid and gid are the unix id's you want the folders mounted as

file_mode is the permissions on files and dir_mode would be same mask for directory level

rsize and wsize are for tuning read and write block sizes

unixmountname -fstype=cifs,credentials=/etc/smbmounts/servername,uid=908,gid=908,file_mode=0774,rsize=32768 ://servername/sharename

for example for the /home /etc/auto.home entry you would create a file /etc/auto.home and put entry like the following for pvalentino's home folder which is hosted on server named filesrv1:

pvalentino -fstype=cifs,credentials=/etc/smbmounts/filesrv1,uid=908,gid=908,file_mode=0774,rsize=32768 ://filesrv1/pvalentino

restart autofs with:

/etc/init.d/autofs restart

or

service autofs restart

cd to your new directory

cd /home/pvalentino

check logs if you get errors.

Major differences in syntax between smbfs and cifs are:

smbfs uses fmask and cifs uses file_mode

smbfs credentials file uses username=DOMAINusername while cifs uses username=username and domain=domain entries

man mount.cifs for more details on mount options that are available

1 comment:

Urk said...

Hi there,

I stumbled upon this article and it seems to be the only one I could find that (nearly) suits my needs. I have been trying to get this working for the past couple of days and am really hoping that someone will be able to help me.

I am trying to setup an automount in AIX 5.3 to a windows share.

I can mount the share manually on the command line like this :

mount -v cifs -n dbalap/username/password -o wrkgrp=DOMAIN,fmode=750,uid=214,gid=201 /shared /test/shared

and that works fine.

I have set things up as directed in the article :

# cat auto_master
/test /etc/auto_test

# cat auto_test
shared -fstype=cifs,rw,credentials=/etc/smbmounts/dbalap ://dbalap/shared

When I try to cd to the directory I get “ksh: /test/shared: Permission denied.”

Below is a cut down ( to fit in this comment ) part of the syslog entries on the subject :

I seem to be going around in circles! One thing I have observed is that the request does not seem to even get as far as the windows host. None of the debug mentions the windows host by name, and a wireshark trace on the windows host turns up literally nothing.

Jun 16 15:47:18 tigger kern:debug unix: auto_root: vfs F100010053FC1550, *vpp F100010051DB3450
Jun 16 15:47:18 tigger kern:debug unix: auto_lookup(T=3346513): dvp=F100010051DB3450 (/etc/auto_test) name=shared fn_name=/test
Jun 16 15:47:18 tigger kern:debug unix: auto_lookup(T=3346513): dvp=F100010051DB3450 dfnp=F100010051DB3400
Jun 16 15:47:18 tigger kern:debug unix: auto_search: dfnp=F100010051DB3400, name=shared
Jun 16 15:47:18 tigger kern:debug unix: auto_search: error=0
Jun 16 15:47:18 tigger kern:debug unix: auto_getattr vp F10001010311EE50
Jun 16 15:47:18 tigger kern:debug unix: auto_getattr return 0
Jun 16 15:47:18 tigger daemon:debug automountd[753724]: mount of /test:shared status 13
Jun 16 15:47:18 tigger kern:debug unix: auto_calldaemon error=0
Jun 16 15:47:18 tigger kern:debug unix: auto_mount_request: path=/test name=shared error=13
Jun 16 15:47:18 tigger kern:debug unix: auto_mount_thread: auto_mount_request returns error=13
Jun 16 15:47:18 tigger kern:debug unix: auto_wait4mount: fnp=F10001010311EE00 error=13
Jun 16 15:47:18 tigger kern:debug unix: auto_trigger_mount(T=6914095): error=13
Jun 16 15:47:18 tigger kern:debug unix: auto_access: error=13
Jun 16 15:47:18 tigger kern:debug unix: auto_inactive: vp=F10001010311EE50 v_count=u fn_link=1
Jun 16 15:47:18 tigger kern:debug unix: auto_disconnect: dfnp=F100010051DB3400 fnp=F10001010311EE00 linkcnt=1 v_count=u
Jun 16 15:47:18 tigger kern:debug unix: auto_disconnect: done
Jun 16 15:47:18 tigger kern:debug unix: auto_freefnnode: fnp=F10001010311EE00
Jun 16 15:47:18 tigger kern:debug unix: auto_freefnnode: done
Jun 16 15:47:18 tigger kern:debug unix: auto_inactive: (exit) vp=F10001010311EE50 freed