Chapter 7. Working Within the Truman Network

Table of Contents
Retrieving and saving files with Samba
Connecting to other computers using SSH
Transferring files with SSH tools
Using the Truman VPN from Linux

Retrieving and saving files with Samba

Most of the files that students use on the Truman network are stored on Windows shares, sometimes called SMB shares or Samba shares. SMB is the name of the protocol used to transfer files to and from these shares, and Samba is the name of the program for Linux that speaks the SMB protocol.

Using Samba, Linux machines can create shares that can be read by the Windows machines on the network. More important for most users, however, is that Samba is the program that allows access to the Truman U: and Y: drives.

To use the Samba shares, it is necessary to know their ``real'' name. The drive letter assignments we generally refer to are just arbitrary names, but the real name specifies where on the network the data is stored. Under Windows, you can learn these names in My Computer. For example, the U: drive is described as Student_files on 'hydrogen'. This tells you the real name of the U: drive in Windows terms is \\hydrogen\Student_files. In a unix environment, we would normally reverse the slashes. The available shares currently at Truman are:

Accessing Windows shares with smbclient

The easiest way to access one of these shares is using the smbclient program. It takes the name of a share, followed by various switches. The most important switches are -U to specify the username for connecting to the share and -W to specify the workgroup (domain).

Example 7-1. Connecting to the U: drive with smbclient


$ smbclient //hydrogen/Student_Files -U dbindner -W truman
added interface ip=150.243.160.42 bcast=150.243.191.255 nmask=255.255.224.0
Password: 
Domain=[TRUMAN] OS=[Windows 5.0] Server=[Windows 2000 LAN Manager]
smb: \>

Once connected, smbclient accepts various commands. Among them are:

Table 7-1. smbclient commands

help lists the commands understood by the program
help command prints help for a specific command
cd change the remote directory
dir (or ls) list the contents of the remote directory
get remotefile get a file from the remote machine
put localfile put a file onto the remote machine
mget or mput get or put multiple files at a time

You can use these commands to navigate the system and transfer files:

Example 7-2. Navigating in smbclient


smb: \> dir
  .                                  DR        0  Fri Aug 30 15:08:00 2002
  ..                                 DR        0  Fri Aug 30 15:08:00 2002
  _BU Student File Area               D        0  Mon Mar 17 17:26:41 2003
  _ED Student File Area               D        0  Wed Feb 26 07:42:55 2003
  _FN Student File Area               D        0  Tue Dec 10 13:12:32 2002
  _HES Student File Area              D        0  Wed Feb  5 16:28:11 2003
  _ITS Student File Area              D        0  Fri Feb 28 14:20:15 2003
  _LL Student File Area               D        0  Tue Dec  3 17:08:22 2002
  _MT Student File Area               D        0  Mon Feb  3 18:39:54 2003
  _NU Student File Area               D        0  Fri Feb 21 11:53:03 2003
  _PL Student File Area               D        0  Wed Mar 19 18:17:48 2003
  _SC Student File Area               D        0  Fri Mar 21 16:42:10 2003
  _SS Student File Area               D        0  Mon Nov 11 15:39:28 2002
  _UB Student File Area               D        0  Tue Dec 17 09:51:32 2002

                19200 blocks of size 4096. 19200 blocks available
smb: \> cd "_MT Student File Area"
smb: \_MT Student File Area\> cd dbindner
smb: \_MT Student File Area\dbindner\> dir
  .                                   D        0  Tue Apr  9 14:05:05 2002
  ..                                  D        0  Tue Apr  9 14:05:05 2002
  brian                               D        0  Tue May  1 05:45:30 2001
  CalcIII                             D        0  Tue May  1 05:45:30 2001
  cs120                               D        0  Tue Apr  9 13:50:21 2002
  gvim.lnk                                   509  Tue Apr  9 14:04:44 2002
  Office2000                          D        0  Tue Apr  9 13:49:38 2002
  Sound                               D        0  Tue May  1 05:44:57 2001
  vim                                 D        0  Wed Oct 16 16:04:40 2002

                19200 blocks of size 4096. 19200 blocks available
smb: \_MT Student File Area\dbindner\> get gvim.lnk
getting file gvim.lnk of size 509 as gvim.lnk (99.4 kb/s) (average 99.4 kb/s)
smb: \_MT Student File Area\dbindner\> quit

Accessing Windows shares using smbmount

If you prefer to have Windows shares appear as regular parts of the unix filesystem, you can do that with the smbmount command. Smbmount has two required arguments: the name of a share, and a directory to attach it to. As with the regular mount command, this directory is often referred to as a mount point.

In addition to the required commands, it is customary to pass some options to the smbmount command via the -o switch. The most common options are username which specifies your Windows account name, and workgroup which specifies your workgroup (sometimes this is called your domain). The command will prompt for the password of this account when it runs.

Note: Mounting and unmounting filesystems usually requires root privileges. On most systems, smbmount ``runs as root,'' but if it does not on yours, you will need to become root first (usually via the su command).

Example 7-3. Mounting a Windows share


$ mkdir u_drive
$ smbmount //Ss1/Student_files u_drive -o username=dbindner,workgroup=TRUMAN
Password:
$

To unmount the share, simply use the smbumount command (note the spelling, just like the regular umount command).

Example 7-4. Unmounting a Windows share


$ smbumount u_drive
$