Samba: Difference between revisions

From miki
Jump to navigation Jump to search
(→‎Samba Client: one more mount example)
No edit summary
Line 8: Line 8:
== Samba Client ==
== Samba Client ==
* To mount a samba share in Linux (see [http://en.opensuse.org/SDB:Access_to_Windows_Shares]):
* To mount a samba share in Linux (see [http://en.opensuse.org/SDB:Access_to_Windows_Shares]):
<div style="padding-left:2em;"><source lang="bash">
{{lp2|<source lang="bash">
$ mkdir -p /windows/winshare
$ mkdir -p /windows/winshare
$ mount -t cifs //winmachine/testshare /windows/winshare
$ mount -t cifs //winmachine/testshare /windows/winshare
$ mount -t cifs -o username=user,password=secret //winmachine/testshare /windows/winshare
$ mount -t cifs -o username=user,password=secret //winmachine/testshare /windows/winshare
$ sudo mount -t cifs -o username=baddreams,allow_utime=22,umask=002,uid=1000,gid=124 //phoenix/D$ /net/phoenix/d
$ sudo mount -t cifs -o username=baddreams,allow_utime=22,umask=002,uid=1000,gid=124 //phoenix/D$ /net/phoenix/d
</source></div>
</source>}}


* Or make it an entry in <tt>/etc/fstab</tt>. Note that '''gid=124''' refers to group '''sambashare'''.
* Or make it an entry in <tt>/etc/fstab</tt>. Note that '''gid=124''' refers to group '''sambashare'''.
<pre>
{{lp2|<pre>
//mnemosyne/backup /net/mnemosyne/backuprw cifs username=backup,allow_utime=22,umask=002,uid=999,gid=124
//mnemosyne/backup /net/mnemosyne/backuprw cifs username=backup,allow_utime=22,umask=002,uid=999,gid=124
</pre>
</pre>}}

== Mount as User ==
To mount a samba share as a regular user (i.e. without sudo), the following conditions must be met:
* <code>/bin/mount</code>, <code>/bin/umount</code>, <code>/sbin/mount.cifs</code>, <code>/sbin/umount.cifs</code> must be '''setuid''' (<code>sudo chmod +s ...</code>)
* share point must be owned by the user (<code>chown username mountpoint</code>).
** May be optional, but does not hurt, set group of mount point to '''sambashare''', and verify that the user is in that group
* mount spec in '''fstab''' must contain the option '''users''' (or '''user''').
** It seems that option '''suid''' should be present as well, but does not seem to do anything good to me.
{{lp2|<pre>
//mnemosyne/public /net/mnemosyne/publicrw cifs noauto,users,guest,allow_utime=22,umask=002 0 0
//mnemosyne/public /net/mnemosyne/public cifs noauto,users,ro,guest,allow_utime=22,umask=002,suid 0 0
</pre>}}

Revision as of 22:15, 30 November 2009

References

Packages

In Ubuntu, install the packages samba and smbfs.

Samba Client

  • To mount a samba share in Linux (see [1]):
$ mkdir -p /windows/winshare
$ mount -t cifs //winmachine/testshare /windows/winshare
$ mount -t cifs -o username=user,password=secret //winmachine/testshare /windows/winshare
$ sudo mount -t cifs -o username=baddreams,allow_utime=22,umask=002,uid=1000,gid=124 //phoenix/D$ /net/phoenix/d
  • Or make it an entry in /etc/fstab. Note that gid=124 refers to group sambashare.
//mnemosyne/backup /net/mnemosyne/backuprw	cifs	username=backup,allow_utime=22,umask=002,uid=999,gid=124

Mount as User

To mount a samba share as a regular user (i.e. without sudo), the following conditions must be met:

  • /bin/mount, /bin/umount, /sbin/mount.cifs, /sbin/umount.cifs must be setuid (sudo chmod +s ...)
  • share point must be owned by the user (chown username mountpoint).
    • May be optional, but does not hurt, set group of mount point to sambashare, and verify that the user is in that group
  • mount spec in fstab must contain the option users (or user).
    • It seems that option suid should be present as well, but does not seem to do anything good to me.
//mnemosyne/public /net/mnemosyne/publicrw	cifs	noauto,users,guest,allow_utime=22,umask=002	0 0
//mnemosyne/public /net/mnemosyne/public	cifs	noauto,users,ro,guest,allow_utime=22,umask=002,suid 	0 0