CSCI 251 Systems and Networks

Lab9  Introduction to Windows SMB Networking using Samba

Wednesday March 24, 2010

Objectives:

Task #1

Perform the following steps, in the order given, on your vbox.

  1. Add your ordinary user account to the adm and root groups. This will allow your user account to access (most) log files in /var/log/. (Remember we used usermod command to add extra groups to a user?) Also add an account on your system for the instructor (username 'csci251'). I will tell which password to use for this account in the lab.

  2. Install any packages needed to run the samba servers, as well as the samba clients smbclient, and smbmount/smbumount. (How do you find the package names? See manual page for dpkg.)  Use the name CSCI251 as the default workgroup name. Note that letters in workgroup names should be UPPERCASE.

  3. The workgroup name, as well as other configuration parameters for Samba, are stored in a text configuration file smb.conf. By default, samba exports user home directories read only. Change this to read/write in the above file. Make sure you make a backup (smb.conf.orig)of the original before changing it.

  4. Using smbpasswd, set up a password for yourself and for the instructor, csci251. The instructor will supply the samba password to use for the csci251 account as well.

  5. Using smbclient, determine the shares available on your computer. (Hint: try the -L option.) When prompted for the password, just hit Enter. Why don't user home directories show up? Now try it again and enter the password when requested. Can you see the difference?

  6. Using smbclient, connect to your home directory on your computer. The command should look something like:

    	smbclient //lenny/myname

    where lenny is the name of your computer and myname is your username. When requested, give the samba password you set up for yourself in a previous step.

  7. Determine what commands are available when connected to an SMB share interactively using smbclient. What command gives a directory listing? What command copies a file?

  8. Exit smbclient. Copy /var/log/syslog file to your home directory.

  9. An alternate method to access SMB shares that are directories is to use the samba smbmount and smbumount commands, which are similar to the standard mount and umount commands. Now use smbmount command to mount your home directory on the directory /tmp.

              smbmount //lenny/myname /tmp

    Was it successful?

    Create a directory called /tmp/remote and mount your home directory on that directory.

    Change directory to /tmp/remote and explore the content. See what the mount command shows.

  10. Use smbumount to unmount the directory.

Task #2

We would now like to test samba using two computers. (Ideally, we should try to use resources  on a Windows computer.) However, we have the same problem we faced earlier because we are in a virtual environment. On the one hand we don't have root access on the host computer and on the other hand we cannot connect to our virtual machine from outside. But for the latter we found a workaround using port forwarding.
  1. Use netstat or nmap on vbox to find out which port samba is using for connections. Now on the host machine run VBoxManage command to set up port forwarding. (See Lab5 for details.) Use an unused port number above 1023 for HostPort and the one that you found out above as GuestPort. Use TCP as protocol.

  2. Run smbclient command to connect to your home directory on vbx using port forwarding. Copy the syslog file in your home directory on vbx to the host system.

Demo

Once you have set up port forwarding correctly and have been able to connect to your home directory, ask the instructor to see your setup. The instructor will try to browse his home directory on your vbx from a remote machine.

Credit

To receive credit for this lab, you must perform the demonstration above and create a single file with the following information and email to the instructor (jayeward@mala.bc.ca) by 8:00 on Monday March 29, 2010.

  1. Where does samba save its log entries?

  2. How did you determine which packages you needed to install for this lab?

  3. Give the output of the following command:

    	diff -c smb.conf smb.conf.orig

    where smb.conf is your final samba configuration file, and smb.conf.orig is the original samba configuration file (as supplied by the Debian GNU/Linux installation).

  4. How does the -c option affect the behaviour of diff?

  5. In smbclient, what command gives a directory listing?

  6. In smbclient, what command copies a file?

  7. What happened when you tried to mount something on top of /tmp? Why? (Hint: what user-id owns /tmp?)