meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
common:mounting_shares [2009/02/24 14:10]
laakkone created
common:mounting_shares [2014/02/07 11:49] (current)
laakkone [How to Mount]
Line 1: Line 1:
-[[itlab|Back to #itlab main page]]+[[start|Back to #itlab main page]]
  
 =====  Migration to CIFS  ===== =====  Migration to CIFS  =====
Line 7: Line 7:
 ====  Recommended Option ​ ==== ====  Recommended Option ​ ====
  
-If you previously had smbfs mounts configured in <tt>fstab</​tt> ​and you use local user database, i.e., administer your own workstation,​ the migration is not trivial. Most of the Samba servers here seem to support CIFS Unix extensions, meaning that mount options ​<tt>uid, gid, dmask, fmask, file_mode, dir_mode</​tt> ​do not work. The UID, GID and file access permissions come from the server as is, and probably they are not the same you want to have on your workstation.+If you previously had smbfs mounts configured in ''​fstab'' ​and you use local user database, i.e., administer your own workstation,​ the migration is not trivial. Most of the Samba servers here seem to support CIFS Unix extensions, meaning that mount options ​''​uid, gid, dmask, fmask, file_mode, dir_mode'' ​do not work. The UID, GID and file access permissions come from the server as is, and probably they are not the same you want to have on your workstation.
  
-The solution is to forget ​<tt>fstab</tt>, and mount the shares as a normal user under your home directory using option ​<tt>noperms</tt><tt>Noperms</​tt> ​disables local file access permissions checking, so the local UID, GID and permissions information can be whatever, they are ignored. You have to mount under your home directory to prevent other users on your workstation from using the shares you mounted. **Otherwise they would have your identity and access rights on the share.** So make sure only you can access the mount points.+The solution is to forget ​''​fstab''​, and mount the shares as a normal user under your home directory using option ​''​noperms''​''​Noperms'' ​disables local file access permissions checking, so the local UID, GID and permissions information can be whatever, they are ignored. You have to mount under your home directory to prevent other users on your workstation from using the shares you mounted. **Otherwise they would have your identity and access rights on the share.** So make sure only you can access the mount points.
  
 ====  Alternative Option ​ ==== ====  Alternative Option ​ ====
  
 If you really want to have the same UID/GID semantics as in smbfs, do this: If you really want to have the same UID/GID semantics as in smbfs, do this:
-<​code>​echo 0 > /​proc/​fs/​cifs/​LinuxExtensionsEnabled<​\/​code>​+ 
 +''​echo 0 > /​proc/​fs/​cifs/​LinuxExtensionsEnabled''​ 
 It disables the Unix extensions on client side. It disables the Unix extensions on client side.
  
Line 20: Line 22:
  
 The general form is: The general form is:
-<​tt>​mount.cifs <​i>//​server/​share</​i>​ <​i>​mountpoint</​i>​ -o noperms,​user=LUT/<​i>​username</​i></​tt>​ 
  
-For umount you must use <tt>umount.cifs</​tt> ​command. It seems to need the absolute path to mount point, +<​code>​mount.cifs //​server/​share mountpoint -o noperm,​user=LUT/​username</​code>​ 
-otherwise it leaves a stale entry in <tt>/​etc/​mtab</​tt>.+ 
 +For umount you must use ''​umount.cifs'' ​command. It seems to need the absolute path to mount point, 
 +otherwise it leaves a stale entry in ''​/etc/mtab''​. 
 + 
 +In Ubuntu, the command ''​mount.cifs''​ comes in the package ''​smbfs''​ (smb filesystem tools or such). Apparently it is not set-uid root by default, so you may need to use ''​sudo''​ with it. Using ''​sudo''​ makes the mounted files owned by root, so you need ''​noperms''​ options. It should be good to make it set-uid root, if you want to be able to mount as a regular user, or you do not want to use ''​noperms''​. 
 + 
 +The option ''​noperms''​ means, that the local file permissions are not used at all. The server will do permissions checking. 
 + 
 +===== File permissions ===== 
 + 
 +If you need to check or change file permissions,​ use ssh to go to a machine, that has the share mounted via NFS. When you mount via CIFS on your workstation,​ the file permissions you see may have unknown user or group ids, or the permissions may be completely bogus (as with ''​noperms''​ option). Suitable servers are: 
 +  * cursa.pc.lut.fi 
 +  * laskenta1.it.lut.fi 
 +  * laskenta2.it.lut.fi 
 + 
 +The path there is ''/​net/​<server>/<share>/'',​ so e.g. <​code>​ssh cursa.pc.lut.fi 
 +cd /​net/​www2/​projects 
 +ls -l 
 +</​code>​
  
 =====  Servers ​ ===== =====  Servers ​ =====
Line 34: Line 53:
 ====  No Unix extensions ​ ==== ====  No Unix extensions ​ ====
  
-For these servers you may want to set mount options ​<tt>dir_mode=00700,​file_mode=00600</tt>.+For these servers you may want to set mount options ​''​dir_mode=00700,​file_mode=00600''​.
  
   * kynnys.pc.lut.fi   * kynnys.pc.lut.fi
Line 43: Line 62:
 ====  pq's cmount script ​ ==== ====  pq's cmount script ​ ====
  
-http://​mediaserver.it.lut.fi/​media/​linux/​cmount+{{:common:​files:​cmount.doc}} (Download and rename to ''​cmount''​ and set execute permission.)
  
-The script ​has server ​configuration inside ​it, and the shares come from directory structure. Here is an example ​directory structure:+Note, that in the script ​''​www2.it.lut.fi''​ is called just ''​server'',​ since it really is **the** server. 
 + 
 +Put ''​cmount''​ to a directory, e.g. ''​$HOME/​net''​, and create ​the following ​directory structure ​under it:
 <​code>​ <​code>​
 . .
-|-- diso 
-|   |-- kurssit 
-|   |-- project 
-|   `-- www 
 |-- files-tite |-- files-tite
 |   |-- HOME |   |-- HOME
 |   `-- tite |   `-- tite
-|-- mediaserver +|-- server 
-|   `-- media +|   |-- projects 
-|-- regulus +|   |-- software 
-|   ​|-- ​project +|   ​|-- ​temp 
-|   ​`-- ​users+|   ​`-- ​www
 `-- ti500433 `-- ti500433
     `-- install     `-- install
-<\/code> +</​code>​ 
-Mounting works by <tt>./​cmount ​diso/www</​tt> ​and umounting must be done by <tt>./cmount -u diso/www</​tt> ​or otherwise the mount may not be removed properly from <tt>mtab</​tt> ​even though it is really unmounted.+ 
 +Mounting works by ''​./​cmount ​server/projects'' ​and umounting must be done by ''​./cmount -u server/projects'' ​or otherwise the mount may not be removed properly from ''​mtab'' ​even though it is really unmounted. You can mount read-only with ''​./​cmount -r server/​projects''​.