Smbmount

From CS Support Wiki
(Redirected from Smbmount under Linux)
Jump to: navigation, search

We do not export NFS shares to computer systems where root is not limited to systems staff; many users who have root on their local linux installations find that using scp/sftp to move files back and forth to department filesystems is tedious. Because the security model for CIFS(SMB) is more finely-grained, we allow access to the SMB daemons from anyhere inside UVA IP address space. We recommend using smbmount or mount -t cifs to mount your home directory on your Linux box (smbmount is deprecated and not fully functional in cases with matching user names between systems).

All you typically need to specify is the share name (MS UNC 'path'), the mountpoint in the local filesystem, and a username:

The MS UNC hueristic looks like:

\\<server_name>\<share_name>

Please note that this is different from the full path in the *nix world; you should not include your partition or "home" in the path. Also, because the "\" character has a legacy special meaning to the shell (ie, 'escape' or ignore the special meaning of the character following the slash), we have to 'flip' the slash to 'unix' slashes:

\\apollo\jpr9c -> //Apollo/jpr9c

Smbmount

Because you must execute the mount command as root (UID 0) you need to pass an alternate UID (username) to the smbmount or mount command:

-o user=<username>

Generally, executing smbmount looks like:

jpr9c@cordelia:~$ sudo smbmount //apollo/jpr9c /mnt -o user=jpr9c
Password: 
jpr9c@cordelia:~$ cd /mnt
jpr9c@cordelia:/mnt$ ls
111506_Electronic Access Form.pdf  Machine_names.xls
2002inventory.xls		   mail
2004users			   Mail

It has been possible in the past to store the password information and have an smbmount run out of /etc/fstab; currently users report this is broken, and in any event, it is inherently somewhat insecure, depending on how good your password storage protection is.

Mount -t cifs

Executing mount -t cifs can be a little more complex. It also requires running as root and it needs the -o switch, as above, but additional options aside from the username are required. The format for the options is:

-o user=<CSUsername>,password=<CSPassword>,domain=CSDOM,rw,uid=<LocalUsername>,gid=<LocalGroupName>

CSUsername and CSPassword are your CS Unix credentials and CSDOM is the CS domain 'rw' indicates mounting will be read/write LocalUsername and LocalGroupName are the local user and group that will own the files and directories when mounted

All together it looks something like this:

bjd5v@hammingvm:~$ sudo mount -t cifs //nas10.itc.virginia.edu/bjd5v /mnt/nas10 
-o username=bjd5v,password=*********,rw,domain=CSDOM,uid=bjduser,gid=bjdgroup
bjd5v@hammingvm:~$ cd /mnt/nas11
bjd5v@hammingvm:~/mnt/nas11$ ls 2*
20121221.html            20130313111240349.pdf
20130214101756318.pdf    20130316102706244.pdf

Because we do not provide support for user-root Linux installs, you will need to experiment with this a bit if you have problems. Please see "man smbmount" (it may redirect to the man page for mount.cifs depending on your system) or "man mount" and "man mount.cifs" for more information.