Connecting to an RCI or Eden Samba Share Using GNU/Linux

 

This document will show you how to connect to a Samba share on the RCI and Eden systems using a program called smbmount.

Before you begin

Before using Samba the following are required:

  1. A valid account on RCI or Eden.
  2. Your Samba share password.
  3. The Samba password can be obtained by going to http://www.rci.rutgers.edu/webtools (faculty/staff) or http://www.eden.rutgers.edu/webtools and clicking on the appropriate link. The password will be sent via e-mail to the account for which Samba is to be accessed)
  4. A computer running a GNU/Linux operating system
  5. The Samba program installed and configured on the GNU/Linux system. Read Appendix I for information on where to obtain the latest version of Samba.
  6. Root privileges on the GNU/Linux computer

Connecting to your RCI or Eden Samba share using GNU/Linux
The command used to mount Samba shares from a GNU/Linux system is called smbmount. This special command usually can only be run by the root (also called "super") user. In order for local users to be able to execute the smbmount command they need to be added to a special file called sudoers. This file can be found in the /etc directory on the machine. The file will need to be edited as the root user using a text editor such as emacs or vi.

  1. On the last line of the /etc/sudoers file the following will need to be entered:

    %users ALL=/path/to/smbmount
    %users ALL=/path/to/smbumount

    In order to find the path to the smbmount command users can type in which smbmount and then the which smbumount on the command line. For example, if by using the which command we find that the path for the smbmount command is /usr/bin/smbmount and the path for the smbumount command is /usr/bin/smbumount, then the last two lines of the sudoers file would look like this:
    %users ALL=/usr/bin/smbmount
    %users ALL=/usr/bin/smbumount

    This will allow all users to mount and unmount their Samba shares.

  2. Logout of the root account and log back in to your regular account.

  3. Create a new directory on the system with the mkdir command. This directory will be where all files in the share on the remote system will be located.
                      

    jsmith@trogdor:~$ mkdir rci_files jsmith@trogdor:~$ ls -al total 24 drwxr-xr-x 5 jsmith users 4096 Dec 2 16:59 ./ drwxr-xr-x 12 root root 4096 Dec 1 09:59 ../ -rw------- 1 jsmith users 1689 Dec 1 12:56 .bash_history drwxr-xr-x 3 jsmith users 4096 Dec 2 13:24 .emacs.d/ drwx------ 2 jsmith users 4096 Dec 2 16:15 .ssh/ drwxr-xr-x 1 jsmith users 4096 Dec 2 16:59 rci_files/> jsmith@trogdor:~$

  4. Use the smbmount command to mount the samba share on the remote system:

    The syntax for smbmount is:

    sudo smbmount //remotehost/share /path/to/local/mountpoint -o username=remoteusername,uid=localusername,gid=localgroup,port=445

    Where:

    • sudo - is the command which allows a program to be run as the root user. Only special users are allowed to use the sudo command. (This is why the /etc/sudoers file needed to be edited in step 1) In this example the smbmount command is being run as the root user.
    • //remotehost/share- this specifies the remote host that the samba share is on and the name of the share. Rutgers allows users to connect to two different shares. One share is called homes. This share is located in the home directory of the account and is the directory named RCI_drive (or for Eden, EDEN_drive. The other share is called www. This share is the public_html directoy on the account. The public_html directory is the directory in which all files which can be accessed through a web browser are located (web pages, pictures, ...).
    • /path/to/local/mountpoint - this is the path to the directory which was created in Step 3 of this document.
    • username=remoteusername- here the remoteusername would be the username for the account which is trying to be accessed.
    • uid=localusername - this is the username of the user on the GNU/Linux system that is trying to access the account.
    • gid=localgroup -this refers to the primary group the local user account on the GNU/Linux System, is a member of. This can be found out by using the id command, on the command line.
    • port=445 - RCI is running Smaba on a special port which older versions of smbmount will not be able to connect to unless this option is specified.

    (NOTE: You will be prompted for two passwords when running smbmount using sudo. The first password will be the password for the local account on the GNU/Linux system that is trying to make the connection. The second password is the Samba password for the account on RCI or Eden.)

    (for example, on an RCI account for a user with a NetID of giantsfan. Eden users would substitute "Eden" for "RCI")

    jsmith@trogdor:~$ sudo smbmount //rci.rutgers.edu/homes /home/jsmith/rci_files/ -o username=giantsfan,uid=jsmith,gid=user,port=445
                        Password: (Enter your LOCAL password here) 
                        Password: (Enter your RCI Samba password here) 

  5. Use mount to check and see if the share was mounted:

    jsmith@trogdor:~$ mount
                        /dev/hda1 on / type ext3 (rw)
    /dev/hda2 on /var type ext3 (rw)
    /dev/hda3 on /home type ext3 (rw)
    devpts on /dev/pts type devpts (rw,gid=5,mode=620)
    proc on /proc type proc (rw)
    usbfs on /proc/bus/usb type usbfs (rw)
    //rci.rutgers.edu/homes on /home/jsmith/rci_files type smbfs (0)

Disconnecting

  1. To unmount a Samba share the smbumount command will be used:
    sudo smbumount /path/to/sharename

    At the password prompt enter the password for your GNU/Linux account

    jsmith@trogdor:~$ sudo smbumount /home/jsmith/rci_files/
                        Password: (enter LOCAL password here)
    

  2. Check to see if the share is un-mounted with the mount command:
    jsmith@trogdor:~$ mount
    /dev/hda1 on / type ext3 (rw)
    /dev/hda2 on /var type ext3 (rw)
    /dev/hda3 on /home type ext3 (rw)
    devpts on /dev/pts type devpts (rw,gid=5,mode=620)
    proc on /proc type proc (rw)
    usbfs on /proc/bus/usb type usbfs (rw)

Common Errors and Solutions

The following are errors that may be experienced when using remote drive mapping with Samba. This list will be updated as needed.
  1. The Network path \\rci.rutgers.edu\www (or \\eden.rutgers.edu\www) could not be found

    That error could mean one of three things:

    1. Your network connection may be unavailable. Try visiting several other web pages both at Rutgers and off-campus.
    2. If you are using a computer off-campus, you may need to connect to the Rutgers Network with the VPN software before trying to map a drive using Samba. Information about VPN can be found at http://oit.rutgers.edu/vpn
    3. The special Samba directories may not yet exist on the account. For example, there may not be a public_html directory on an account so the www share won't be able to connect. A public_html directory can be created by connecting to an RCI or Eden account with SSH and entering the command mkdir public_html. A directory called RCI_drive or EDEN_drive is automatically created for the homes share when remote drive mapping is enabled, and should not be deleted. If that happens, use SSH and re-create the directory using the command mkdir RCI_drive or mkdir EDEN_drive.

Appendix I

Where can I Obtain the Latest Version of Samba?

Samba comes installed by default on most distributions of GNU/Linux. The latest version of Samba can be downloaded from:

ftp://sftp.rutgers.edu/pub/samba/

Pre-compiled binaries for popular GNU/Linux distributions are available in the Binaries directory.

If Samba is being compiled from the source code, smbmount will need to passwd as a compile option. Instructions on how to do this are available at:

http://samba.rutgers.edu/samba/smbfs

Need Help? Call the OIT NBCS Help desk at 732-445-HELP (4357) or send email to helpdesk@nbcs.rutgers.edu


Return to RU Main Site
For more information contact helpdesk@nbcs.rutgers.edu
Last updated: June 22, 2005, 6:16 pm