Windows Network Share

From ArchWiki
Revision as of 14:53, 1 January 2010 by Pwd (Talk | contribs) (Allowing users to mount: mv notes after content)

Jump to: navigation, search

Template:Article summary start Template:Article summary text Template:Article summary heading Template:I18n entry Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary end

Preparation

Install the Template:Package Official package with pacman:

# pacman -S smbclient

Automatic share mounting

There are several alternatives for easy share browsing.

smbnetfs

1. Install Template:Package Official:

# pacman -S smbnetfs

2. Add the following line to Template:Filename:

user_allow_other

3. Load the Template:Codeline kernel module:

# modprobe fuse

4. Start the Template:Codeline daemon:

# /etc/rc.d/smbnetfs start

All shares in the network are now automatically mounted under Template:Filename.

Add the following to Template:Filename to access the shares at boot:

MODULES=(... fuse ...)
DAEMONS=(... smbnetfs ...)

fusesmb

Note: Because Template:Codeline is malfunctioning with Template:Codeline, revert to using older versions if necessary. See the relevant forum topic for details.

1. Install the Template:Package AUR package from the AUR using yaourt or other AUR Helpers:

$ yaourt -S fusesmb

2. Create a mount point:

# mkdir /mnt/fusesmb

3. Load Template:Codeline module:

# modprobe fuse

4. Mount the shares:

# fusesmb -o allow_other /mnt/fusesmb

For mounting shares at boot, add the command above to Template:Filename and add Template:Codeline module to Template:Filename:

MODULES=(... fuse ...)

Autofs

Autofs is a kernel-based automounter for Linux. See the Autofs wiki article for details.

Manual share mounting

1. Create the mount point for the share:

# mkdir /mnt/MOUNTPOINT

2. Mount the share using Template:Codeline. Keep in mind that not all options may be needed nor desirable, such as Template:Codeline:

# mount -t cifs //SERVER/SHARENAME MOUNTPOINT -o user=USERNAME,password=PASSWORD,workgroup=WORKGROUP,ip=SERVERIP
Template:Codeline
The Windows system's name
Template:Codeline
The shared directory
Template:Codeline
The local directory where the share will be mounted to
Template:Codeline
Specifies options for Template:Codeline
Template:Codeline
Username used to mount the share
Template:Codeline
The shared directory's password
Template:Codeline
Used to specify the workgroup
Template:Codeline
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 Template:Filename will not work.

3. To unmount the share, use:

# umount /mnt/MOUNTPOINT

Adding the share to Template:Filename

Add the following to Template:Filename for easy mounting:

//SERVER/SHARENAME /mnt/MOUNTPOINT cifs noauto,noatime,users,username=USER,password=PASSWORD,workgroup=WORKGROUP 0 0

The Template:Codeline option disables mounting it automatically at boot and Template:Codeline 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, Template:Filename needs to be modified. Add the Template:Codeline options to the entry in Template:Filename:

//SERVER/SHARENAME /mnt/SHAREMOUNT cifs users,noauto,noatime,username=USER,password=PASSWORD,workgroup=WORKGROUP 0 0
Note: The option is Template:Codeline (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 setuid bit is potentially dangerous and is not recommended.