You can access your Lafayette file shares from Linux by installing the appropriate tools and either connect to the shares with smbclient, or mount the shares on your filesystem. Linux is not an officially supported platform and these instructions are offered only as a convenience for technically oriented users.

To access file shares from off campus on a Windows, macOS, or Linux device, you must first be connected to the VPN.

Install Samba Client tools

Popular Linux distributions come with package managers which should contain a client to allow you to connect to a Samba server. The commands to install Samba clients on some of the more popular distributions are below:

  • Ubuntu/Debian:
    apt-get install smbfs smbclient
  • CentOS/Fedora/RedHat
    yum install samba-client cifs-utils smbclient

The installation of the packages above allow you to directly mount a samba share or connect to a samba share using the smbclient command line utility. For more information see the documentation for your distribution; e.g. Ubuntu Samba Client Guide.

Select a Samba Share

ITS offers two types of file shares:

Your Personal Home Share: This is a private network share accessible only to you which cannot be shared with others. The address for your home share is:

  • \\samba.lafayette.edu\home

All other file shares: This is a network share that nearly everyone in the college has access to but with differing levels of privilege; e.g. only people in the Athletics department may have access to the Athletics directory. The address for this share is:

  • \\samba.lafayette.edu\shared

Two Methods to connect to Samba with Linux

  1. Connecting to Samba with smbclient: This allows you to simply connect to samba without having to understand the basics of Lafayette’s implementation of MS-DFS (Microsoft’s Distributed File System). After you are connected you can upload or download files to the server.
  2. Mounting a Samba Share into your file system: If you have a Linux workstation and want your samba shres to always be available as part of your file system so you can work directly on the samba share (as opposed to a copy on your local file system), then you can use this method. Because this method does not support MS-DFS (Microsoft’s Distributed File System) you first need to query the DFS server (samba.lafayette.edu) to determine the exact server and share name that you want to mount.

 

Method 1: Connecting to file shares with smbclient

smbclient is an ftp-like commandline tool you can use to connect to a samba server and upload or download files. smbclient supports MS-DFS (Microsoft’s Distributed File System). To access the two types of Samba shares described in the previous section of the document use one of the following commands with $netid replaced by your Lafayette NetID:
smbclient //samba.lafayette.edu/home -U $netid
smbclient //samba.lafayette.edu/shared -U $netid

You will then see a prompt:
Enter your password:
Type your password, then press enter. If the logon was successful, you should see something like:
Domain=[DOMAIN] OS=[Unix] Server=[Samba x.y.z]
And a shell prompt:
smb: \>
Now that you are connected, there are many commands at your disposal, including:

  • ls : lists all files/subdirectories of the present directory
  • cd [dirname] : moves to the directory specified by [dirname] on the remote server
  • lcd [dirname : moves to the directory specified by [dirname] on the local machine
  • mkdir [dirname] : makes a directory with the specified name in the present directory
  • rmdir [dirname] : deletes the specified directory
  • rm [filename] : deletes the specified file
  • get [filename] [localfilename] : downloads the specified file to the local machine. If [localfilename] is specified, renames the file to that on the local machine.
  • put [local file name] [remote file name] : copies the file with name [local file name] on the local machine to the server, with name [remote file name], if specified
  • exit : terminates the connection
  • help : displays a list of commands. ‘help command’ will give you information about ‘command’

Note that accessing a different Samba share will require you to log out of smbclient and connect again to the new share. For instance, if you have access to two shares, ‘home’ and ‘shared’, if you access the ‘home’ share and want to transfer a file from there to the ‘shared’ share, you will have to download the file from ‘home’ (via the get command), log out, log on to the ‘shared’ share, and upload the file.

Method 2: Mounting a Samba Share into your file system

Lafayette’s Samba servers support MS-DFS (Microsoft’s Distributed File System) so that the server and share name can be transparent for users of Microsoft Windows. Lafayette ITS supports Samba access from the Macintosh by providing a client which can discover and mount the appropriate file server and share for any valid user. If you are using Linux, don’t want to use smbclient, and want to mount a Lafayette samba share directly, then you need to query Lafayette’s the MS-DFS server (samba.lafayette.edu) to determine which shares you have access to. To query an MS-DFS server you can run the rpcclient command, which is provided by installing the Samba Client described above. The rpcclient command can be run like the following where $netid is your Lafayette NetID:
rpcclient –username=’$netid’ –command=’dfsenum 3′ samba.lafayette.edu

When running the above you should see output like the following:
$ rpcclient –username=’jetsong’ –command=’dfsenum 3′ samba.lafayette.edu
Enter jetsong’s password:
path: \\SAMBA0\home
comment:
state: 1
num_stores: 1
storage[0] server: samba0
storage[0] share: home
path: \\SAMBA0\home\jetsong
comment:
state: 1
num_stores: 1
storage[0] server: smbfile1.lafayette.edu
storage[0] share: home_staff
path: \\SAMBA0\shared
comment:
state: 1
num_stores: 1
storage[0] server: samba0
storage[0] share: shared
path: \\SAMBA0\shared\psychology
comment:
state: 1
num_stores: 1
storage[0] server: smbfile4.lafayette.edu
storage[0] share: psychology
$

Based on the output of the rpcclient command you should choose the share you want to mount; e.g. George Jetson (jetsong) could pick ‘smbfile4.lafayette.edu’ as the server and ‘psychology’ as the share because he sees that the “storage[0] server” is smbfile4. It’s important not to confuse this with the path which says SAMBA0 (which is really just the DFS server).
Once you have picked the server and the share you can use the mount.cifs command to connect to the share as in the following:
sudo mount.cifs //smbfile4.lafayette.edu/psychology/ /smb/psychology -o user=jetsong

In the above example George Jetson (jetsong) is mounting the psychology share that he discovered earilier using the rpcclient command as documented above. The command above assumes that /smb/psychology is an exising mount point on his file system. George is then free to interact with /smb/psychology as if it were a part of his file system provided that his computer remains on the network. If he were to disconnect, then he would use the umount command (e.g. ‘sudo umount /smb/psychology’).