smbclient/smbmount

If you have installed a recent version of Linux, chances are that you have also installed smbclient and smbmount. If so, the following instructions will enable you to mount your HOME directory from a Linux box using our SAMBA server. This might prove particularly useful for those who are interested in accessing their HOME directory while off-campus. If you fall in this category see the SSH sections of the smbclient and smbmount directions. For what it is worth, if you do have smbmount installed I would recommend using this instead of smbclient. However, I cover both procedures. Please note: Although smbclient and smbmount are part and parcel of SAMBA, you do not need to have SAMBA running on your laptop. SMBCLIENT A. Using smbclient without SSH smbclient is rather less useful than smbmount but it does enable you to copy files back and forth from your Linux laptop and your HOME directory. It is somewhat similar to ftp in terms of function and ease of use. 1. Run the following command: smbclient //smb.cs.toronto.edu/username -U username So, if Jerry wants to access his HOME dir he would type: smbclient //smb.cs.toronto.edu/jerry -U jerry 2. Once authenticated, you will see a smb prompt: smb: \> A good beginning is to use the built-in smblclient help via ?. smb: >? B. Using smbclient with SSH If you try to run smbclient from off-campus, it will not succeed because UT blocks inbound SMB connections. However, UT does not block SSH connections! So we can tunnel the SMB connections through SSH. Let us use the example of Jerry again to show how this is done. 1. First we must make an SSH connection that tunnels port 139. ssh -l jerry -L 1100:smb.cs.toronto.edu:139 qew.cs.toronto.edu Once you are connected leave this window/xterm running and open a new window/xterm. 2. Open a new window/xterm and supply the following command: smbclient //127.0.0.1/jerry -p 1100 -U jerry This command tells smbclient to connect to your local machine on port 1100; since port 1100 is tunneled via SSH to smb, you are for all intents and purposes making a connection to smb.cs.toronto.edu. 3. After authenticating you should again be able to copy files back and forth using the smb: > prompt SMBMOUNT A. Using smbmount without SSH Most people will find smbmount a more useful mechanism because it can be used to mount your home directory in such a way that appears to be another local directory. I shall user the fake user Jerry again. 1. Create a new sub-directory in your Linux file-system. I shall use: /mnt/cslabhome mkdir /mnt/cslabhome 2. Now use this new directory to mount your HOME directory. smbmount //smb.cs.toronto.edu/jerry /mnt/cslabhome -o username=jerry At this point your HOME directory is available for use. 3. cd /mnt/cslabhome 4. To unmount it use: smbumount /mnt/cslabhome B. Using smbmount with SSH This is probably the most powerful use of smbmount since it enables off-campus students to mount their HOME directory. We also recommend using it while on campus since it affords greater protection for your password because it is encypted by SSH. For most versions of Linux you will need to be root to actually perform the smbmount itself. 1. Create a new sub-directory in your Linux file-system. I shall use: /mnt/cslabhome mkdir /mnt/cslabhome 2. Set up an SSH tunnel for smbmount to use. ssh -l username -L 1100:smb.cs.toronto.edu:139 qew.cs.toronto.edu Leave this SSH connection running and proceed to the next step. 3. Now we are going to smbmount /mnt/cslabhome: smbmount //localhost/username /mnt/cslabhome -o port=1100,username=username Using Jerry as our example user, the command would be: smbmount //localhost/jerry /mnt/cslabhome -o port=1100,username=jerry 4. cd /mnt/cslabhome 5. To unmount it use: smbumount /mnt/cslabhome