Linux Map a Network Drive

From ITwiki

(Difference between revisions)
Jump to: navigation, search
m (changed path and share -> sharename)
m (added missing sudo)
(5 intermediate revisions not shown)
Line 1: Line 1:
-
{{no support}}
 
== Requirements ==
== Requirements ==
-
Before you can mount Windows Shares you need to have samba.<br>
+
Before you can mount Windows Shares you need to have CIFS or SMBFS installed.<br>
You also need support built into the kernel.
You also need support built into the kernel.
If you are using a binary distribution your kernel should be automatically configured for this.<br>
If you are using a binary distribution your kernel should be automatically configured for this.<br>
-
=== Getting Samba on Ubuntu ===
+
To install the required mount and unmount utilities and allow users to mount Windows Shares, follow the instructions below.
 +
 
 +
=== Getting CIFS/SMBFS installed on Ubuntu or Debian ===
Open a terminal and type:
Open a terminal and type:
  sudo apt-get install smbfs
  sudo apt-get install smbfs
-
To install the required mount and unmount utilities.
+
 
 +
=== Getting CIFS/SMBFS installed on RedHat ===
 +
 
 +
Open a terminal and type:
 +
sudo yum install cifs-utils
 +
 
 +
=== Setting mount.cifs and umount.cifs SetUID root to allow user mounts ===
 +
Issue the command
 +
sudo chmod u+s /sbin/mount.cifs /sbin/umount.cifs
== Instructions ==
== Instructions ==
-
You can map a network drive to [[Storage01]] using the smbmount utility. You can run the following command as a regular user:
+
You can map a network drive to [[Storage01]] using the mount.cifs utility. Now that mount.cifs is installed SetUID root, you can run the following command as a regular user:
-
  $ smbmount //storage01.stevens.edu/sharename /path/to/mount -o user=myusername,domain=campus
+
  $ mount.cifs //storage01.stevens.edu/sharename /path/to/mountpoint -o user=myusername,domain=campus
-
* '''//storage01/share''' is the mount location.  Replacing 'share' with your [[Campus Domain Account|domain username]] will map the network drive to your personal storage space.  Please read the article on [[Storage01]] for other possible locations.
+
* '''//storage01.stevens.edu/sharename''' is the mount location.  Replacing 'sharename' with your [[Campus Domain Account|domain username]] will map the network drive to your personal storage space.  Please read the article on [[Storage01]] for other possible locations.
-
* '''/path/to/mount''' is the location you want to map/mount the network drive at.  You can map it to a mountpoint in your current directory such as 'mnt' by not using any slashes (full pathname is also fine)
+
* '''/path/to/mountpoint''' is the location you want to map/mount the network drive at.  This should be an empty directory owned by you.  You can map it to a mountpoint in your current directory such as 'mnt' by not using any slashes (a full pathname like /home/you/mnt is also fine)
* ''username''='''myusername''' - '''myusername''' should be replaced with your [[Campus Domain Account|Stevens username]].
* ''username''='''myusername''' - '''myusername''' should be replaced with your [[Campus Domain Account|Stevens username]].
-
* ''workgroup='''campus''' - this specifies the domain to check your username and password against, leave it like this
+
* ''workgroup''='''campus''' - this specifies the domain to check your username and password against, leave it like this
-
* ''uid''='''mylocalusername''' - mylocalusername should be the name of your linux user (whoami will tell you this if you are unsure).  This is the user who owns the directory/mountpoint you are mounting/mapping to.
+
 
-
* ''ip''='''storage01.stevens.edu''' - this specifies an "ip address" (a [[FQDN]] in this case) to locate [[Storage01]] by.  Leave as-is.
+
When you run this command, you should see a prompt similar to:
When you run this command, you should see a prompt similar to:
  Password:
  Password:
Type in your [[Campus Domain Account|Campus Domain password]] and press enter.  You will now be able to access the file stored on storage01 at the mountpoint you specified.
Type in your [[Campus Domain Account|Campus Domain password]] and press enter.  You will now be able to access the file stored on storage01 at the mountpoint you specified.
 +
To unmount the drive, type
 +
$ umount.cifs /path/to/mountpoint
[[Category:Linux]][[Category:Storage01]]
[[Category:Linux]][[Category:Storage01]]

Revision as of 16:05, 10 February 2012

Contents

Requirements

Before you can mount Windows Shares you need to have CIFS or SMBFS installed.
You also need support built into the kernel. If you are using a binary distribution your kernel should be automatically configured for this.

To install the required mount and unmount utilities and allow users to mount Windows Shares, follow the instructions below.

Getting CIFS/SMBFS installed on Ubuntu or Debian

Open a terminal and type:

sudo apt-get install smbfs

Getting CIFS/SMBFS installed on RedHat

Open a terminal and type:

sudo yum install cifs-utils

Setting mount.cifs and umount.cifs SetUID root to allow user mounts

Issue the command

sudo chmod u+s /sbin/mount.cifs /sbin/umount.cifs

Instructions

You can map a network drive to Storage01 using the mount.cifs utility. Now that mount.cifs is installed SetUID root, you can run the following command as a regular user:

$ mount.cifs //storage01.stevens.edu/sharename /path/to/mountpoint -o user=myusername,domain=campus
  • //storage01.stevens.edu/sharename is the mount location. Replacing 'sharename' with your domain username will map the network drive to your personal storage space. Please read the article on Storage01 for other possible locations.
  • /path/to/mountpoint is the location you want to map/mount the network drive at. This should be an empty directory owned by you. You can map it to a mountpoint in your current directory such as 'mnt' by not using any slashes (a full pathname like /home/you/mnt is also fine)
  • username=myusername - myusername should be replaced with your Stevens username.
  • workgroup=campus - this specifies the domain to check your username and password against, leave it like this

When you run this command, you should see a prompt similar to:

Password:

Type in your Campus Domain password and press enter. You will now be able to access the file stored on storage01 at the mountpoint you specified.

To unmount the drive, type

$ umount.cifs /path/to/mountpoint
Personal tools