Difference between revisions of "Windows Network Share"

From ArchWiki
Jump to: navigation, search
m (Autofs: rm repeated ln)
(redir to Samba: no content was windows specific, resulting in a merge)
 
Line 1: Line 1:
[[Category:Networking (English)]]
+
#REDIRECT[[Samba]]
[[Category:HOWTOs (English)]]
+
{{Article summary start}}
+
{{Article summary text|An overview of methods available to users wishing to access Windows shares using [[Samba]].}}
+
{{Article summary heading|Available in languages}}
+
{{i18n entry|English|Windows Network Share}}
+
{{Article summary heading|Related articles}}
+
{{Article summary wiki|NFS}}
+
{{Article summary wiki|Samba}}
+
{{Article summary end}}
+
==Preparation==
+
Install the {{Package Official|smbclient}} package with [[pacman]]:
+
# pacman -S smbclient
+
 
+
==Automatic share mounting==
+
There are several alternatives for easy share browsing.
+
 
+
===smbnetfs===
+
1. Install {{Package Official|smbnetfs}}:
+
# pacman -S smbnetfs
+
 
+
2. Add the following line to {{Filename|/etc/fuse.conf}}:
+
user_allow_other
+
 
+
3. Load the {{Codeline|fuse}} kernel module:
+
# modprobe fuse
+
 
+
4. Start the {{Codeline|smbnetfs}} [[daemon]]:
+
# /etc/rc.d/smbnetfs start
+
 
+
All shares in the network are now automatically mounted under {{Filename|/mnt/smbnet}}.
+
 
+
Add the following to {{Filename|/etc/rc.conf}} to access the shares at boot:
+
MODULES=(... '''fuse''' ...)
+
DAEMONS=(... '''smbnetfs''' ...)
+
 
+
===fusesmb===
+
{{Note|1=Because {{Codeline|smbclient 3.2.X}} is malfunctioning with {{Codeline|fusesmb}}, revert to using older versions if necessary. See the [http://bbs.archlinux.org/viewtopic.php?id=58434 relevant forum topic] for details.}}
+
 
+
1. Install the {{Package AUR|fusesmb}} package from the [[AUR]] using [[yaourt]] or other [[AUR Helpers]]:
+
$ yaourt -S fusesmb
+
 
+
2. Create a mount point:
+
# mkdir /mnt/fusesmb
+
 
+
3. Load {{Codeline|fuse}} module:
+
# modprobe fuse
+
 
+
4. Mount the shares:
+
# fusesmb -o allow_other /mnt/fusesmb
+
 
+
For mounting shares at boot, add the command above to {{Filename|/etc/rc.local}} and add {{Codeline|fuse}} module to {{Filename|/etc/rc.conf}}:
+
MODULES=(... '''fuse''' ...)
+
 
+
===Autofs===
+
Autofs is a kernel-based automounter for Linux. See: [[Autofs]] for details.
+
 
+
==Manual share mounting==
+
1. Create the mount point for the share:
+
# mkdir /mnt/MOUNTPOINT
+
 
+
2. Mount the share using {{Codeline|mount.cifs}}. Keep in mind that not all options may be needed nor desirable, such as {{Codeline|password}}:
+
# mount -t cifs //''SERVER''/''SHARENAME'' ''MOUNTPOINT'' -o user=''USERNAME'',password=''PASSWORD'',workgroup=''WORKGROUP'',ip=''SERVERIP''
+
 
+
;{{Codeline|SERVER}}: The Windows system's name
+
;{{Codeline|SHARENAME}}: The shared directory
+
;{{Codeline|MOUNTPOINT}}: The local directory where the share will be mounted to
+
;{{Codeline|-o [options]}}: Specifies options for {{Codeline|mount.cifs}}
+
:;{{Codeline|user}}: Username used to mount the share
+
:;{{Codeline|password}}: The shared directory's password
+
:;{{Codeline|workgroup}}: Used to specify the workgroup
+
:;{{Codeline|ip}}: The IP address of the server -- if the system is unable to find the Windows computer by name (DNS, WINS, hosts entry, etc.)
+
 
+
{{Note|Abstain from using trailing directory ('''/''') characters. Using {{Filename|//SERVER/SHARENAME'''/'''}} will not work.}}
+
 
+
3. To unmount the share, use:
+
# umount /mnt/MOUNTPOINT
+
 
+
===Adding the share to {{Filename|/etc/fstab}}===
+
Add the following to {{Filename|/etc/fstab}} for easy mounting:
+
//SERVER/SHARENAME /mnt/MOUNTPOINT cifs noauto,noatime,users,username=USER,password=PASSWORD,workgroup=WORKGROUP 0 0
+
 
+
The {{Codeline|noauto}} option disables mounting it automatically at boot and {{Codeline|noatime}} increases performance by skipping inode access times.
+
 
+
After adding the previous line, the syntax to mount files becomes simpler:
+
# mount /mnt/MOUNTPOINT
+
 
+
===Allowing users to mount===
+
Before enabling access to the mount commands, {{Filename|fstab}} needs to be modified. Add the {{Codeline|users}} options to the entry in {{Filename|/etc/fstab}}:
+
//SERVER/SHARENAME /mnt/SHAREMOUNT cifs '''users''',noauto,noatime,username=USER,password=PASSWORD,workgroup=WORKGROUP 0 0
+
 
+
{{Note|The option is {{codeline|user'''s'''}} (plural). For other filesystem types handled by mount, this option is usually  ''user''; sans the "'''s'''".}}
+
 
+
For users to be allowed to mount and unmount the Samba share, the setuid flag must be activated on the following two files to allow users to execute the commands with elevated privileges:
+
# chmod u+s /sbin/mount.cifs
+
# chmod u+s /sbin/umount.cifs
+
 
+
{{Warning|A more secure option is to use [[sudo]] to grant privileges. Setting the [[Wikipedia:setuid|setuid]] bit is potentially dangerous and is not recommended.}}
+

Latest revision as of 15:26, 1 January 2010

Redirect to: