Daily Technology News, Tips, and Reviews | Subscribe to Jason Slater Technology BlogTechnology Feed | Join Jason Slater on TwitterTwitter | Thursday 2nd September 2010

Mounting a Windows Share under AIX using CIFS

By Jason Slater
  • DiggThis
  • Share

Mounting a Windows Share under AIX using CIFS There are several options for transferring files between AIX and Windows, including NFS, SAMBA, SCP and FTP – all have there advantages and disadvantages but a recent connection method that we have been using is to mount a Windows Share as a CIFS (Common Internet File System) VFS (Virtual File System).

Trying to mount a Windows 2003 Share on an AIX Server (v5.3) using the CIFS virtual file system can be a bit tricky but extremely useful once implemented. Initially CIFS support may require installing unless it is already installed – you can check this by looking in the /sbin/helpers folder for a file mount_cifs

#cd /sbin/helpers
#ls -l

total 488
drwxrwxr-x   2 root     system         1024 Dec 05 2004  jfs2
-r-xr-xr-x   1 root     system        17342 Jul 02 18:20 mount_cifs
-r-x——   1 root     system         3576 Jul 02 18:20 mount_smbfs.

If it is not installed then install it from the Base Operating System CD #1

#installp -ac -d /dev/cd0 bos.cifs_fs

Upon completion a reboot may be required. Ensure the nsmbo device is available by running the lsdev command:

#lsdev

mem0       Available
nsmb0      Available
paud0      Available 01-Q2

Create a username and password in the Windows 2003 domain for handling the share and set the necessary permissions on the share and folder (also consider the use of a $ prefix at the end of the share to hide it). You also need to create a mount point on the AIX machine over which to mount the share (you can just create an empty folder, e.g. mkdir /foldername)

You can then attempt to mount the share over over the mount point.

#mount -v cifs -n node/username/password [-o options] /windowsshare /directory

When I initially ran this I received the following error:

There was an error connecting the share or the server.
Make sure the lsdev command shows that device nsmb0 is in
the Available state.  Also make sure that the share name,
user name and password are accurate.

Checking the Security Log on to Windows Server showed the following event had been raised:

Event Type:    Failure Audit
Event Source:    Security
Event Category:    Logon/Logoff
Event ID:    529
User:        NT AUTHORITY\SYSTEM
Computer:    computername
Logon Failure:
     Reason:        Unknown user name or bad password
     User Name:    username
     Domain:        NODOMAIN
     Logon Process:    NtLmSsp
     Authentication Package:    NTLM
     Workstation Name:    \\workstation
     Source Network Address:    xxx.xxx.xxx.xxx

As I was using a domain the command seemed to require the fmode parameter  and the wrkgrp parameter, so running this command fixed it:

#mount -v cifs -n serverip/username/password -o wrkgrp=domain,fmode=755
/sharename /localmountpoint

More details of the mount command can be found in the IBM Command Reference: mount Command

Related

11 comments so far

  • Marx says:

    Thanks for your note, it helps a lot.

    This parameter was usefull for me :
    -o wrkgrp=test.test,fmode=755,uid=200,gid=201

  • paul says:

    This was entirely awesome – thanks!!! I was using SCP prior to this and now that I have CIFS installed and understand how to use it, you have just saved me a TON of time.

  • alex says:

    thank you. this helped a lot

  • Munna says:

    Hey Dude,

    Thts really owesome…. :-) This article has saved my lots of days…. :-) Is there any way we can make this mount permanent,,,I mean even if we reboot the AIX the mount should be there, it should not be removed after reboot.

    Keep it up for this kind of good articles… :-)

  • simon says:

    great post. thanks so much.

  • Narendra Babu Swarna says:

    For mounting Windows shares in AIX. We can use mkcifsmnt, chcifsmnt and rm cifsmnt commands.

    Check these commands are available in AIX box(If not install complete bos.cifs file system.

    these commands also adding the entries in /etc/filesystems file.

    Note: At present these commands are available in AIX 6.. and if you want them in AIX5.3, copy these files and supported files from AIX 6. :-) . Surely they will work

  • kah00na says:

    Here’s the syntax for mkcifsmnt:

    mkcifsmnt -f MountPoint -d RemoteShare -h RemoteHost
    -c user [-p password] [-m MountTypeName] [-A|-a] [-I|-B|-N]
    [-t {rw|ro}] [-u uid] [-g gid] [-x fmode] [-w workgroup]

    After you run the mkcifsmnt command, you will see an entry in your /etc/filesystesms similar to this:

    /local_directory:
    dev = /remote_share
    vfs = cifs
    nodename = remote_server.domain.com/userid
    mount = true
    type = cifs
    options = uid=274,gid=220,fmode=750
    account = false

    If you add the remote password to the “nodename” line, then it will automatically reconnect after a reboot, like this:

    nodename = remote_server.domain.com/userid/password

  • Gabriel Menini says:

    Hello,

    This is a very useful tutorial.

    My co-workers report that using mkcifsmnt wasn’t enough to have the FS mounted after a reboot.

    They have to add to /etc/inittab a line similar to the following:

    cifsmount:2:once:/usr/sbin/mount -v cifs -n remote_server.domain.com/userid/password -o wrkgrp=windomain,fmode=755 /local_directory /remote_share

    Even using a dumb combination of Windows Domain user/password, I don’t feel comfortable leaving a password in plain text.

    IBM online manuals state that password are hashed in /etc/cifs_fs/cifscred, so why is it needed to put it in /etc/inittab?

    T.I.A.

  • Jawad says:

    Hi,
    The windows share drive was mounted and now its not anymore on our AIX servers. I think the windows server team had done maintenance to increase the size of the share. After now if i try to mount it back, it gives me the error

    There was an error connecting the share or the server.
    Make sure the lsdev command shows that device nsmb0 is in
    the Available state. Also make sure that the share name,
    user name and password are accurate.

    I checked it on my computer and the size of the share has increased to 2T now. I am not sure if this has caused any permission issue on the user account i am using on aix side to mount the share drive. Your comments will be helpful

  • Rick says:

    Hi All

    In order to make my mount persistent across reboots, I did use the “mkcifsmnt” command, then I edited my /etc/filesystems file and added a trailing “/” on the “nodename” entry:

    nodename = SERVERNAME/WINDOZE_USERID/

    That trailing “/” seems to force things to use the /etc/cifs_fs/cifscred file to authenticate.

    Cheers,
    Rick

  • Ravi says:

    Just make sure that error always come if you didnt shared directory from Windows.

    First share directory from windows(2003,XP.etc…) whatever you want mount.

    Thanks,
    Ravi

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.