Total Pageviews

Search: This Blog, Linked From Here, The Web, My fav sites, My Blogroll

Translate

07 April 2010

Ubuntu --- Setting Up a Samba Server

Samba is probably the best example of the value that open 
source software can bring to modern computing, 
enabling seamless data sharing between Unix-
like and Microsoft Windows systems thanks 
to a fantastic combination of reverse 
engineering and insightful
development.

CIFS/SMB


Like it or not, the planet is populated with Windows machines. As you can see  from statements like that, I’m probably as guilty as anyone of propagating the “us vs. them” mentality when it comes to Windows vs. Linux. How I personally feel about Windows and Microsoft really doesn’t matter — the important thing here is to discuss the various ways in which software available on Linux systems makes it easy to integrate Linux and Windows filesystems in both directions, getting features such as automatic printer sharing as freebies along the way.
    You’d have to have been living in a cave for the last eight or so years not to have heard of Samba, arguably one of the most popular applications ever written for Linux and Unix-like systems.
In a nutshell, Samba is a set of applications that was originally developed to provide support for Microsoft’s networking protocols on Linux systems, but which has been ported to just about every other network-aware operating system.
A huge number of books are available that are dedicated to discussing Samba, explaining every nuance of its configuration files, installation, and use. My goal here is not to embed another one inside a text on Ubuntu, but rather to provide some interesting background information about Windows networking and Samba, and then to explain how to use Samba to share directories and printers on your Ubuntu system so that Microsoft Windows users in your home, academic, or business computing environment can access them.



Overview of Microsoft Windows File Sharing

Networking and related technologies such as routing are probably responsible for more acronyms than any other aspect of the computer industry. MS-DOS and Microsoft Windows networking have contributed their share, largely because of the ubiquity of these operating systems in modern computing environments.
    Because of the popularity of DOS systems (yesterday) and Windows systems (today), today’s Windows systems provide support for almost everyone’s networking protocols. Frankly, Windows does an admirable job of continuing to make forward progress while still maintaining backward compatibility with almost every ancient DOS application and networking protocol. Windows systems still support the Internet Packet Exchange (IPX) and Sequenced Packet Exchange (SPX) networking protocols used by Novell to provide the first PC file servers.
    However, more relevant for our discussion here are the networking protocols and attendant acronyms that were developed by Microsoft and used to provide file and resource sharing over PC networks without requiring the involvement of any third parties, thank you very much.
    The Basic Input and Output System used by PCs to interact with local devices is best known by its initials as the PC’s BIOS. As networks began to appear, Microsoft extended the capabilities of the BIOS to support accessing and sharing information over a network, naming the related protocols the network BIOS, or as it’s more popularly known, NetBIOS. Just as the BIOS provides the basic functions that support all system input and output, the NetBIOS provides the basic functions that let you use and administer network services.  
NetBIOS commands and functions must be exchanged between networked systems and therefore require a lower-level network transport mechanism to move network packets from one host to another. 
The lower-level transport protocols that are still in common use in PC networking today are:
  1. IPX (Internet Packet Exchange)
  2. NetBEUI (Network Basic Extended User Interface), and 
  3. TCP/IP (Transmission Control Protocol/Internet Protocol).
Interestingly, the word “Internet” in the full names of both IPX and TCP/IP refers to inter-network communications, not the Internet as we know it today.

Modern Windows systems send their NetBIOS requests by using TCP/IP as a transport protocol (NetBT). On top of the NetBIOS level, Windows networking provides a higher-level interface for network services known as the Server Message Block (SMB) protocol, which is a networking protocol that can be easily used by applications.
    SMB is a connection-oriented protocol rather than a broadcast protocol, meaning that it depends on establishing connections to specific networked services provided by other networked hosts rather than simply broadcasting its availability. Once a connection is established, SMB provides four basic types of functions:
  • Session functions that negotiate and establish networked connections between machines (often referred to as virtual circuits), authenticate, and verify the access privileges that each party has with the other.
  • File functions that enable applications to open, close, read, and write remote files, shared directories, and so on.
  • Printer functions that enable applications to spool output to remote output devices.
  • Message functions that enable applications to send and receive control, status, and informational messages between different systems on the network.
SMB became an Open Group standard for networking interoperability in the early 1990s.
Samba takes its name from SMB, the addition of two vowels making it easily pronounced and somewhat softer than simply being YAA (Yet Another Acronym).
In recent developments, an enhanced version of the SMB protocol called CIFS (Common Internet File System) was submitted by Microsoft to the IETF (Internet Engineering Task Force), an open association of people that are interested in the architecture of Internet communication and the smooth operation of the Internet.
CIFS has been approved as a standard, and extends the capabilities of SMB by expanding its focus to sharing resources using even more open, cross-platform standards such as HTTP URLs (HyperText Transfer Protocol Uniform Resource Locators) and DNS (the Domain Name System used to map hostnames to IP addresses and vice versa).

Introducing Samba
When you get right down to it, more data is probably stored on Windows systems than on any other type of computer system. All of those 1TB home and office systems add up to a tremendous number of Windows filesystems holding a staggering amount of data. Samba gives Linux users transparent access to Windows filesystems, but is more commonly used to give Windows users transparent access to Linux, Unix, and Unix-like systems. Samba does this by providing a network interface(SMB) that is compatible with the networked file and printer-sharing protocols used between Windows systems. To a Windows system, a Linux system running Samba looks exactly like a random Windows system that is sharing filesystems across the network.
    This enables Windows users to take advantage of the speed, power, and capacity of Linux systems without even realizing that they are accessing Linux filesystems. Samba is a free and impressive interface (for Linux, Unix, and other types of systems) to any other networked device (also routers-gateways ultimately) that can communicate using the SMB protocol, most notably Windows systems that provide networked access to files, directories, and printers. Samba enables Windows users to access Linux file systems and resources just like any other Windows shared file system or networked resource.
For example, with Samba running on a Linux system on your network, Windows users can mount their Linux home directories (as networked Windows drives) and automatically print to Linux printers just like any other networking Windows printer. 
Samba, which was originally authored by Andrew Tridgell, (who has received numerous awards and accolades for it. Tridgell still works on it today, though thousands of others have contributed to Samba and it is now a team effort. Tridgell created Samba in a massive feat of reverse engineering the protocol and how it worked, because Microsoft’s specifications for SMB weren’t publicly available (big surprise). Today, thanks largely to Tridgell and Samba, Microsoft has opened up the SMB specification, which is now part of its larger CIFS --Common Internet File System-- specification.), is one of the most impressive pieces of interoperability software ever developed.
Samba includes both client and server software — in other words, client software that enables users to communicate from Linux machines to SMB hosts on your network, and server software that provides an SMB interface for your Linux machine. 
Using the Samba client software is discussed in the next section. After that section,  we focus on explaining how to install and set up a Samba server.

As a preface for the Samba server section, we can say that a Samba server actually consists of two processes, both of which can be started from the command line or automatically by integrating them into your system’s startup procedure. These processes are:
  1. smbd, the Samba daemon that provides file sharing and print services to Windows clients
  2. nmbd, the NetBIOS name server that maps the NetBIOS names used by Windows SMB requests to the IP addresses used by Linux(and all the world other) systems.
The Samba daemon is configured by modifying its configuration file, /etc/samba/smb.conf. On Ubuntu systems, you can either
  1. configure specific directories that you want to export via Samba using graphical tools, as explained in the section entitled “Using the Shared Folder Tool to Share Directories,” or 
  2. you can manually modifying the Samba configuration file, as discussed later in the section entitled “ Samba Server Configuration Essentials.”
Interoperability between Linux and Windows systems is much more than just Samba.
The Linux kernel provides built-in support for the protocols used to access Windows filesystems, enabling Linux users to mount Windows filesystems via entries in /etc/fstab, just like any other filesystem resource.


Accessing Shares on Remote Windows Systems(smb's client)
Your Ubuntu Linux system can easily access shared directories on Microsoft Windows systems (commonly known as shares) thanks to one of the most popular and useful open source software packages ever created, Samba. Samba takes its name from the SMB (Server Message Block) protocol that is the original underlying protocol used for networked file sharing on Microsoft Windows systems. As mentioned, you can also use Samba to share files from a Linux system so that specified directories look like Windows shares and Windows users can access them. This requires that you set up a Samba server as we see in a little.

This section focuses on accessing a shared Windows directory from the desktop of your Ubuntu Linux system and copying files to or from that Windows share (A Ubuntu's clean install contain smbclient binary that represent the smb's client part).
    Ubuntu’s Places menu provides the Connect to Server command, which makes it easy to create an icon on your desktop for a Windows share and connect to that share using the Nautilus file manager. Selecting Places ➪ Connect to Server displays the dialog. To specify that you want to connect to an Windows SMB server that requires authentication, click the Service type menu at the top of this dialog and select the Windows share entry to display the dialog shown in Figure.

You must at least enter the name or IP address of the Windows server (Server field in dialog window) that hosts the share that you want to connect to. If you want to provide your own name for the desktop icon that this command will create, you can enter that in the Bookmark name field, which can be handy because the default name of the icon is the name of the Windows server, and you may want to connect to multiple shares on the same server and avoid confusion.
You can also identify the name of the user that you want to connect as (User field), the name of the Windows domain or workgroup that you want to connect as (Domain name field), and the share that you want to connect to (Share field), but all of this is optional — you’ll be prompted for anything that you don’t specify here when you attempt to connect. I prefer to put as much information as possible here, but that’s up to you. 
Click Connect to create a desktop icon for the Windows share that you have defined.
    If you look really closely, you’ll see that the icon created for a Windows share by the Connect to Server dialog displays a little network connection beneath it, and displays a small red flag with the letters SMB inside it to its right (all that can be a little bit different in newer Ubuntu versions). If you end up creating lots of files on your desktop and have really good eyesight, this makes it easy to identify the protocol used to connect to various directories. This can come in handy, especially if you also use the Connect to Server mechanism to connect to FTP, WebDAV,SSH servers.
Simply creating a desktop icon for a Windows share doesn’t actually establish the connection. To do that,  double-click on the appropriate desktop icon to open it. You will see a dialog that prompts you for any required information that you probably have not specified yet.
Once you enter any remaining information (password etc) about the share that you want to connect to and the server on which it resides, a Nautilus file manager window appears which displays the contents of the default directory associated with the user that you are logged in as.
    Once the Nautilus file manager displays, copying files in either direction uses the standard Nautilus and GNOME desktop conventions. Once you are done accessing the Windows share, close the Nautilus file manager window.
To discard the desktop icon, right-click on the icon for the Windows share and select Unmount Volume from the pop-up menu to sever the connection and discard the icon. If you want to reuse the share definition, you can simply leave the icon on your desktop when you log out — the next time that you log in, the icon will still be present, but you will have to re-authenticate to access the Windows share again (all that can be a little bit different in newer Ubuntu versions).


Installing the Samba Server and Friends
To install the packages required to run and monitor a Samba server on your Ubuntu system:

Start the Synaptic Package Manager from the System ➪ Administration menu, and click Search to display the search dialog. Make sure that Names and Descriptions are the selected items to look in, enter samba as the string to search for, and click Search.
    After the search completes, scroll down until you see the samba-common and samba-server packages, right-click each of these packages and select Mark for Installation from the pop-up menu. You may also want to select the samba-doc and samba-doc-pdf packages, which respectively provide HTML and PDF versions of all of the official Samba project documentation, plus an online copy of a book entitled Samba 3 By Example by one of the leaders of the Samba project, John Terpstra.
    Depending on what software you have previously installed on your Ubuntu system and what you select in Synaptic, a dialog may display that lists other packages that must also be installed, and ask for confirmation. When you see this dialog, click Mark to accept these related (and required) packages. Next, click Apply in the Synaptic toolbar to install the Samba server and friends on your system. Once the installation completes, you’re ready to share data with any system that supports SMB.



Samba Server Configuration Essentials

At the moment, the almost absence (exist few of them because of the *nixes shell orientation) of a graphical tool for setting up and configuring Samba on Ubuntu systems is a rather glaring omission to the standard user-friendliness that Ubuntu users have come to expect. I’m not the only person to have noticed this, and there are active discussions on various Ubuntu lists and forums about developing such tools.
    However, for the time being, you must do your initial Samba configuration in the aging but tried-and-true Linux way — by editing configuration files using a text editor. Samba’s configuration file is /etc/samba/smb.conf. The Samba configuration file contains many helpful comments, which are lines beginning with a hash mark. It also contains many sample, inactive configuration commands, which are lines beginning with a semicolon. These indicate configuration commands that you may want to activate by removing the leading semicolon (instead the default configuration commands --reported only as a reminder-- begin with #).


Identifying Your Workgroup or Domain
The Samba configuration file is divided into several sections, each identified by a section name enclosed within square brackets. The entries related to the network identity of your Samba server and how you authenticate to it are located in the [global] section of the Samba configuration file /etc/samba/smb.conf.
The key entry that you must set to define how your Ubuntu server interacts with Windows systems is the workgroup entry, which identifies the Windows workgroup or Windows domain to which your Samba server belongs.
On a sample system of mine, this entry looks like the following:

[global]
   workgroup = WVH

This entry identifies my machine as belonging to the Windows workgroup or domain named WVH. In this SOHO example, it’s a workgroup, but that is essentially transparent — the key thing here is that your Samba server is either a member of the workgroup/domain that you are already using at your site, or a primary domain controller that defines the domain that you want it to host.
If you want your Samba server to function as the primary domain controller (PDC) for a Windows domain, you must also change the domain master setting in the Samba configuration file to yes, and make sure that the entry is not commented out. 
In this case, the entry would look something  like the following:

domain master = auto

This means that the Samba server will serve as a primary domain controller for your domain if no other domain controller can be located, which will be the case if your Samba server is hosting the domain.

Here i explain how to use Samba as part of a workgroup, which is the typical way that Samba is used on a home or SOHO network.
For information about setting up a complete Windows domain, make sure  that you installed the samba-doc as suggested in the section of this chapter entitled “Installing the Samba Server and Friends,” and consult the online copy of Samba 3 By Example that is provided in the directory /usr/share/doc/samba-doc/htmldocs/Samba3-ByExample.
Because this example shows a small workgroup, you will probably also want to activate the entries that tell Samba not to function as a WINS (the Windows NetBIOS name service), but to instead use your system’s Domain Name Server to look up Windows hostnames, which should look like the following:

wins support = no
dns proxy = yes
name resolve order = lmhosts host wins bcast


The last entry tells Samba that clients:
  1. will first look in their local lmhosts file for name information
  2. will then check information in the file /etc/hosts on the Samba server
  3. will then check WINS (which, in this case, is proxied to the local DNS server), and 
  4. will finally use a broadcast to search for the right host
This combination covers the hostname lookup bases for every Samba server configuration that I’ve ever set up or used.
    This completes the core modifications to the Samba configuration file that are necessary for Samba to be able to share files with the specified workgroup or domain.


Configuring Samba Authentication
In the workgroup configuration that we are using as an example here, Samba comes preconfigured to perform the type of authentication required by workgroup members. However, to be able to access shared resources, you must be able to authenticate to the Samba server. Samba maintains its own authentication information — to add login and password information about a user, you must use the smbpasswd command.
When adding information about a user, you must use the –a (mean add) option, followed by the name of the user that you want to add. 
The smbpasswd command will prompt you for a password and will then prompt you for that password again to ensure that you have typed the password correctly. A sample transcript of adding the user wvh is the following:

$ sudo smbpasswd -a wvh
Password:
New SMB password:
Retype new SMB password:

The first password prompt is from the sudo application, asking for my Ubuntu password so that i can perform this privileged operation. The second two are for entering and verifying the Samba password for the user wvh.
The default security level in the Samba configuration file, security = user, requires that Samba users must also exist in the password file(/etc/passwd) on the Ubuntu system, or you will receive an error message and the smbpasswd command will fail. For information about other security models and their implications, see the file file:///usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html from the  samba-doc package.

Sharing Printers and Home Directories Using Samba
After setting up:
  1. the workgroup and 
  2. creating a user
the next thing to consider is the general resources on the Ubuntu system that you want to make available to all users of Windows systems that connect to your Samba server. The most common examples of these are
  1. printers and 
  2. users’ home directories
The entries in the [global] section of a Samba configuration file that are relevant to printers and printing on Ubuntu are the following, which you should make sure are not commented out (i.e., preceded by a semicolon):

load printers = yes
printing = cups
printcap name = cups 

Later in the Samba configuration file, the [printers] and [print$] sections provide information about how your Windows system will interact with the Samba server. You won’t need to change any of these, but for your reference, these entries are the following:

[printers]
   comment = All Printers
   browseable = no
   path = /tmp
   printable = yes
   public = no
   writable = no
   create mode = 0700
[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = no

  1. The [printers] section identifies how the Samba server will handle requests for printer identification and incoming print requests from Windows clients, 
  2. while the [print$] section maps the traditional Windows print$ share name to a directory on your Linux system where you can put the print drivers for specific printers so that your Windows clients can locate and load them if they are not already available on a client system.

Aside from printers, the most natural resource for users to want to access from their Windows systems is their Ubuntu home directories. This provides an easy way to use your home directory on a Samba server as a centralized place to store files, but also enables you to automatically back up files from your Windows system to the Samba server and enables you to leverage any standard backups that you are doing on the Samba server. (See here  for more information about backing up files on your Ubuntu system)
    Happily, Samba’s configuration file is already set up to support sharing home directories by default, as long as your Linux and Windows user names match. The [homes] section of the Samba configuration file that supports this is the following:

[homes]
    comment = Home Directories
    browseable = no
    writable = no
    create mask = 0700
    directory mask = 0700

As you can see from this configuration file excerpt, home directories are shared by default but are not  writable from Windows clients. This is pretty inconvenient, so you will want to change the writable entry in  this section of the configuration file to yes, as in the following example:
         writable = yes
This enables users to both read and write files in their home directories. If your Windows and Ubuntu users happen to have different logins, you can associate the two by creating appropriate entries in the file /etc/samba/smbusers. Entries in this file have the form: 

UnixLogin = WindowsLogin 
For example, to map the Ubuntu user wvh to the Windows user bill.vonhagen, I would create the following entry in the /etc/samba/smbusers file:
 wvh = bill.vonhagen
If your Windows login names contain one or more spaces, you must enclose them within quotation marks in this file. I suggest keeping logins the same across Ubuntu and Samba systems, but this file can be used if you have different naming conventions for the users of different types of systems.


Verifying the Samba Configuration File
After making any changes to your Samba configuration file, you should verify that you haven’t accidentally violated the syntax of the file. If a Samba configuration file contains any invalid entries, Samba displays an error message and will not load. This could be extremely discouraging, were it not for the fact that the Samba server package also provides a utility that tests the validity of a Samba configuration file and identifies the exact location of any errors that it finds. This utility is testparm, which you can run with no arguments to test the default Samba configuration file /etc/samba/smb.conf. The output from a run of the testparm utility looks like the following:

$ testparm
Load smb config files from /etc/samba/smb.conf
Processing section “[homes]”
Processing section “[printers]”
Processing section “[print$]”
Loaded services file OK.
WARNING: passdb expand explicit = yes is deprecated
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

As shown in the preceding example, after displaying some general information, the testparm utility prompts you to press Enter on your keyboard to see detailed information about the services that your Samba server has been configured to provide. An example of this detailed information is the following:

[global]
workgroup = WVH
server string = %h server (Samba, Ubuntu)
obey pam restrictions = Yes
passdb backend = tdbsam, guest
syslog = 0
log file = /var/log/samba/log.%m
max log size = 1000
name resolve order = lmhosts host wins bcast
printcap name = cups
panic action = /usr/share/samba/panic-action %d
invalid users = root
printing = cups
print command =
lpq command = %p
lprm command =

[homes]
comment = Home Directories
read only = No
create mask = 0700
directory mask = 0700
browseable = No

[printers]
comment = All Printers
path = /tmp
create mask = 0700
printable = Yes
browseable = No

[print$]
comment = Printer Drivers
path = /var/lib/samba/printers

Depending on the version of Samba installed on your Ubuntu system and the changes that you have made to your Samba configuration file, your output may differ slightly.
    The testparm utility only checks the Samba configuration fileit does not consult the running Samba service for information about how it is configured and the services that it provides. To do this, you can use the smbclient utility, as described in the next section.



Testing Samba Availability and Services
The Samba applications suite includes an application called smbclient, which is a command-line client for contacting and browsing Samba servers. You can also use this utility to test if your Samba server is up and running, and to list the services that it is providing.
    If you have made any changes to your Samba configuration file, you should restart your Samba server before attempting to verify the services that it provides. To do this, execute the following command:

/etc/init.d/samba restart

This command shuts down any instance of the Samba server that is currently running, and then starts the Samba server again, which forces it to read your updated configuration file.
    Once you have done this, you can query your Samba server by using the smbclient application; the –L option to list available resources; the name of the host that you want to contact; and the –U% option to show what a default, non-authenticated user would see. An example of this command and its output is the following:

$ smbclient -L ulaptop -U%
Domain=[WVH] OS=[Unix] Server=[Samba 3.0.22]
          Sharename      Type      Comment
         ---------      ----      -------
         ADMIN$         IPC       IPC Service (ulaptop server (Samba,Ubuntu))
         IPC$           IPC       IPC Service (ulaptop server (Samba,Ubuntu))
         print$         Disk      Printer Drivers Domain=[WVH] OS=[Unix] Server=[Samba 3.0.22]
         Server              Comment
         ---------           -------
         ULAPTOP             ulaptop server (Samba, Ubuntu)
         Workgroup           Master
         ---------           -------
         WVH                 ULAPTOP
  1. The first portion of this output lists the shares available to the current user, which is an unauthenticated user. 
  2. The second provides information about the name of the Samba server that you have contacted and 
  3. the workgroup or domain that it is a member of.
Looking good! The next step is to see what an authenticated user would see. I’ll use the sample user wvh, which I created earlier. This time, the command and its output look like the following:

wvh@ulaptop:~$ smbclient -L ulaptop -Uwvh
Password:
Domain=[ULAPTOP] OS=[Unix] Server=[Samba 3.0.22]
         Sharename      Type      Comment
         ---------      ----      -------
         ADMIN$         IPC       IPC Service (ulaptop server (Samba,Ubuntu))
         IPC$           IPC       IPC Service (ulaptop server (Samba,Ubuntu))
         print$         Disk      Printer Drivers
         wvh            Disk      Home Directories Domain=[ULAPTOP] OS=[Unix] Server=[Samba 3.0.22]
         Server              Comment
         ---------           -------
         Workgroup           Master
         ---------           -------
         WVH                 ULAPTOP

Note that because i specified an actual username, the smbclient utility first prompted me for my password on the Samba server, and then displayed slightly different information. The only real difference is that an authenticated user has access to his or her home directory on the Samba server, as you can see in the Home Directories entry in the Sharename section of the first portion of the smbclient output.
    Congratulations! Now that it’s clear that the Samba server is working and is correctly configured to allow users to access user-specific resources, it’s time to add some system-wide resources that all authenticated users will be able to take advantage of. Luckily, as explained in the next section, you can even do this with a graphical tool.


Using the Shared Folder Tool to Share Directories
Though Ubuntu Linux doesn’t provide(per default) a graphical tool for setting up and configuring Samba itself, it does provide an easy-to-use graphical tool (nautilus-share) that simplifies identifying and configuring specific directories that you want to export via Samba from your Ubuntu system. If you have already exported shared directories using NFS, this tool should already be familiar to you — the Ubuntu and GNOME folks were clever enough to use the same tool for identifying and configuring both Samba shares and NFS exports. Nautilus Share 
allows you to quickly share a folder from the GNOME Nautilus file manager without requiring root access.
  1.  To start this tool, select Places ➪ Network (in older Ubuntu releases System ➪ Administration ➪ Shared Folders. After supplying your password in the administrative authentication dialog that displays, the Shared Folder tool starts). 
  2. This dialog shows any shares that you have already defined, which in this case shows the /opt2 directory that i am sharing with NFS users. To define a directory that you want to share via Samba, click Add to display a dialog. 
  3. As you can see this dialog is already set up with the basic information required for defining an SMB share. The default exported/shared directory that is initially selected when you start the Shared Folder tool is your home directory. This isn’t all that exciting because Samba shares these automatically, so in this example, I’m going to share the directory that contains my online audio collection.
  4. To specify another directory for sharing, click the Path item and select Other from the drop-down menu to display the directory selection dialog. To select a directory somewhere on your system, click root and navigate through the directory tree on your system to select the directory that you want to export, which in this example is my /opt2 directory. Click Open to select that directory (or whatever directory you want to export) and return to the dialog previously shown, which now displays the name of the newly selected directory in the Path field. 
  5. Next, you’ll need to identify the sharing settings and name resolution mechanism to access (i.e., mount) this directory over the network. 
  6. To verify these, click the General Windows sharing settings button to display the dialog. This dialog shows that this directory will be shared from your Samba server using the WVH workgroup, and that WINS need not be used to locate the server — hosts file or DNS information will suffice
  7. Click OK to return to the dialog previously shown. You may want to enter some general information about the share that you are defining in Name and Comment fields, for future reference. 
  8. This dialog also enables you to use the “Read only” checkbox to specify that you want the directory to be shared in read-only fashion. If this box is not selected, properly authenticated users can create and modify files in directories that they have access to. 
  9. Similarly, you can select the Allow browsing folder checkbox to enable unauthenticated users to browse the shared directory without being able to examine any of the files that it contains. To continue, click OK to redisplay the originally shown dialog , which now contains the settings for your newly defined SMB shared directory.
  10. Almost done! To subsequently modify or update the settings for any shared directory, you can highlight its name in the nautilus and click Properties to display the specific settings for that shared folder. To begin sharing the folder, click OK to start the specified type of file sharing and close the nautilus.
As you might suspect, defining SMB shared in the Network tool actually just creates the correct entries for those shares in your Samba configuration file, just as creating NFS exports in this tool adds the correct entries to the /etc/exports file used by NFS. The entries that were added to the /etc/samba/smb.conf file for the share that you just defined are the following:

[opt2]
   path = /opt2
   comment = Music
   available = yes
   browseable = no
   public = yes
   writable = yes

Adding these entries to the standard Samba configuration file ensures that the newly defined shares will always be available as soon as the Samba daemon (smbd) is started on the Ubuntu system that is acting as a Samba server.


Getting More Information About Samba
Not surprisingly, the Web provides an excellent source of additional information about Samba. Somewhat surprisingly, the Samba project itself provides some excellent documentation, as well as an online version of a great book about the current version of Samba, which is Samba version 3. As suggested earlier, you can install your own copies of the Samba documentation by installing the samba-doc and samba-doc-pdf packages when you install the Samba server. For more information, consult any of the following:
  • samba.org: The main site for the Samba project, at which you can find the latest tips, tricks, and source code.
  • /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO: A directory containing a HOWTO file in HTML format that explains how to install and configure Samba version 3, and answers many common questions. (You’ll want to open the file index.html in this directory from your Web browser). The HTML version of this document is provided in the samba-doc package.
  •  /usr/share/doc/samba-doc/htmldocs/Samba3-ByExample: A directory containing an HTML version of an excellent, hands-on book about Samba 3. This book was written by John Terpstra, one of the leaders of the Samba project, and explains how to install and configure Samba 3 for a complete spectrum of networked environments, from smaller SOHO environments (as discussed here) to enterprise environments with thousands of users. (You’ll want to open the file index.html in this directory from your Web browser). The HTML version of this document is provided in the samba-doc package. You’ll probably also want to buy a paper copy of  John’s book — it’s definitive, complete.
  • Samba old minihowto (pdf)

4 comments:

  1. http://reddragon-linux.blogspot.com/2011/05/linux-samba-server-setup.html

    ReplyDelete
  2. Appreciate your laconic message & post @reddragon ;-)

    ReplyDelete
  3. Configure Samba server:
    http://www.redhatlinux.info/2011/11/configure-samba-server.html

    ReplyDelete
  4. Thanks for sharing....
    Even we can access the samba server from other linux flavours also, the below link is very easy to understand the samba concepts,
    http://www.redhatlinux.info/2011/11/configure-samba-server.html

    ReplyDelete