|
Comments
Did you read today's front page stories & breaking news?
SYS-CON.TV
|
Desktop Linux on a corporate desktop Part 2: File sharing with Samba
How to install, configure, and use Samba.
By: Nick Davis
Mar. 18, 2002 12:00 AM
(LinuxWorld) -- An hour before I deleted Windows 98 from my computer at work, I asked a colleague if she would oblige me to store some MP3s on her computer. I explained I was messing around with my computer, and wanted to store some songs in a safe spot. She said yes. (Thank you, Jen.) I navigated to her machine on the network, and dropped several gigabytes of music into her shared directory. As I completed this task, I noted how user-friendly Microsoft, and Apple for that matter, make local area networking. Since my Linux workstation needed to converse with my coworker's Windows 9x computers on Microsoft's terms, I had some work to do. (See How to get Linux on your corporate desktop, Part 1 for the backstory on this saga.) If I could configure my Linux box to browse the network with the same ease that Windows and Macintosh users do, so much the better. Luckily, found two little applications that help us set up and take advantage of the monster called Samba, and allow us to poke around a local Windows domain and mount shared files. While it may seem frivilous to set up Windows-Linux filesharing to retrieve music, this exercise illustrates how easy it is to slip a Linux computer into a corporate network. The first step is finding the Samba suite. Luckily, I use Slackware 8.0, which comes stock with Samba running like an Olympic track and field star. Most recent Linux distributions come with Samba. If your version does not, open a browser, navigate to www.google.com/linux and type "Samba" into the search query field. Freshmeat or Tucows will be near the top of the results. Kick around until you find the most recent version of Samba. As of this writing, the latest version is 2.2.3a. Download the tarball and save it to your home directory. That's right, I said tarball. Tar.gz. Definitely not the RPM. We're using source. We want to walk before we run. "Okay," you say. "I've downloaded this file. What the heck do I do with it?" "You compile and install it, silly." Here's how:
Now you can delete the .tar file, or save it in whichever directory you like to save .tar files. We have source code!
This is going to be fun. The very first action that should be performed when you get to this point with ANY source code is to read the README file. I like to use pico to read text files. You may prefer vi, jstar, or emacs. Pico is super quick and easy. Type pico README to read the README file. Read this file in its entirety. Since you learned so much reading the README documentation, you may be capable of completing the Samba install on your own. If this is the case, get on yer horse and start riding, although I welcome you to read along with the rest of us and walk through the process together.
Samba configurationBefore I can get my MP3s back and screamin' in my ears, I need to edit the smb.conf file. The smb.conf file is located in one of two places: the /etc directory, or the /etc/samba directory. I tend to place it in both directories. If something happens to one, I have a back-up in the bullpen.The smb.conf file is set up the same way as most config files. There are variables, and there are values. If the variable was IP ADDRESS the value would be YOUR.I.P.ADDRESS example:
Edit the file, go down through each variable, and enter the correct values for your specific network situation. I encourage you to manually edit this file and learn smb.conf's details. I have edited the smb.conf so many darned times -- I hate editing it -- I found a quick solution to this problem. GnoSamba configurationGnoSamba is a graphical interface for editing the smb.conf file. Search Freshmeat.com for gnosamba. Download the tarball. Compile and install the source:
gunzip gnosamba-version.tar.gz
tar -xvf gnosamba-version.tar
cd gnosamba-version/
pico README
pico INSTALL
./configure
make
su {root password}
make install
ldconfig
exitFollowing the above commands should have GnoSamba installed in a jiffy. Now type The GUI will fly onto the screen. smb.conf begs to be configured. Click the File menu in the top-left hand corner of the GUI, then drop down to and select Open Configuration File. This action loads the current settings listed in smb.conf file. Services are listed on the left, parameters and values are listed on the right. Select the "Global" service on the left. On the right, you can double-click each parameter, and enter a new value to be associated with that parameter. Go ahead and change the "Workgroup" value to match your workgroup or domain on the Windows network. Go ahead and change all the values listed in smb.conf to match your particular network environment. There are far too many values for me to go every single one of them. If you don't know what changing one of the values will do, then leave it at its default. You can go back and read the smb.conf file for a better idea of what everything does.
Once you are done changing all of the values in the smb.conf file, go ahead and click the menu-button titled "Write". This will finalize the changes to the smb.conf file. After you are done changing the configuration file, navigate to the "File" menu and select "Exit". Browsing the networkNow that we have configured smb.conf, we may browse the network. After this, those MP3s will be mine!We need to go to www.google.com/linux, and search for an application called LinNeighborhood. LinNeighborhood is a great Samba front end, and is akin to the LinNeighborhood network browser bundled into the different Windows operating systems. It allows you to browse the network, and mount network shares in your filesystem. Once these network shares are mounted, you can treat them like any other directory in your filesystem. If configured, you can read and write to these mounted directories. Download the latest LinNeighborhood tarball. As of now, the latest version I could find was 0.6.4. Once downloaded, compile and install the application. Again:
gunzip LinNeighborhood-version.tar.gz
tar -xvf LinNeighborhood-version.tar
cd LinNeighborhood-version/
pico README
pico INSTALL
./configure
make
su
{root password}
make install
ldconfig
exitWe have two more things to do before we can browse the network. Slackware 8.0 by default installs a kernel with smbfs loadable as a module. This smbfs is a type of network file system, and is a loadable module. This module technology is similar to a "driver" in the Windows environment. Modules need to be activated before they are of any use. To activate the smbfs module, become "root" and modprobe smbfs:
su
{root password}
modprobe smbfs
exitThere won't be any output when you do this, but rest assured the module was loaded. It might be a good idea to set this module to be loaded at boot time. You can do this in the /etc/rc.d/rc.local script. Become "root", type pico /etc/rc.d/rc.local, and add modprobe smbfs to the bottom of the file. Make sure there is not a "#" symbol in front of this line. Last thing: We need to make sure we will have permissions to mount the share. Mounting a share means to create a directory in your local file-system, which represents a directory on a remote machine. You must have the correct permissions to mount a remote share on your local filesystem. smbmount is responsible for mounting remote shares. smbmount actually calls upon smbmnt to mount the share to your file system. What we need to do is make smbmnt SUID root, so it is able to do its job. su
{root password}
chmod 4755 /usr/bin/smbmnt
exitThat's it. Ready, set, browse!TypeLinNeighborhood and press enter to initialize the application. Next, go to the "Options" menu and select "preferences". Here you can specify your workgroup, along with your user name and password information for the workgroup. Save your changes and click "okay". Now, you can again go to the "Options" menu, and select "Browse entire network". This will bring up a dialogue box that asks if you want to browse as a different user. Decide which user you'd like to browse the network as, and click okay. This will scan the network, and display all of the available computers on the network. Click the "+" symbol next to each computer to expand that particular computer's shared directories. When you find a directory you'd like to browse, double-click that directory. Another dialogue box will appear. This dialogue box allows you to specify where in your file system you'd like to mount this share. You are also given the option of mounting the share as a different user. Remember where the default mount-point is. Click "mount". Now you can open your favorite file manager -- Slackware 8.0 comes with nautilus -- and browse the share. Finally! There are all my MP3s. Now I just copy them to the directory of my choice. Although it seems that they are on my hard drive, they are really housed on another machine on the network. You should poke around the rest of the menus in LinNeighborhood. Look at some of your options. It's a great program. ReviewWe've accomplished quite a few things today. We learned how to install the Samba suite, how to install source code, the basics of configuring Samba, and how to browse the Windows network. We also learned how to load a module, add a line to the start-up script, and set a SUID of a file to root. I hope you had fun.Reader Feedback: Page 1 of 1
SOA World Latest Stories
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
|
SYS-CON Featured Whitepapers
Most Read This Week |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||