Introduction: I've Made Progress, Feel I Have Something to Say, But I Don't Know It All
I've finally made some (more) progress in getting Samba to work on (between) my Linux systems. Sometime earlier, I had been successful at getting smbclient to work on my Linux systems so that I could share files with my Windows (95) systems. It seems like an appropriate time to make a snapshot introduction to what I think I know about Samba. (Some of these things I learned recently, some, some time ago.) I used to feel fairly comfortable setting up Microsoft networking between my Windows computers. I only recently became able to do the same thing between my Linux computers, and I'm rather certain that, while I've explored more than just the tip of the iceburg, I have quite a bit more to learn.
More Stuff to Say
Don't Install (or Compile) Samba
(Let your distro do it.)
Start with a (Simple) Linux to Linux Setup
Share level security, share a single file, directory, or printer (simple smb.conf), start with read only, maybe a guest with no userid/password, etc.
Why I'm Using Samba for Linux to Linux
Never learned NFS, not sure I want to (how big is the learning curve)
In any case, with Samba I can talk Linux to Linux, Windows, Mac, etc. with NFS I'm fairly certain I can't talk to Windows (or not with typical mainstream available software--maybe there is an NFS client / server for Windows?)
Terminology
Microsoft (Windows) Networking
Microsoft networking (or Windows networking) is what I'm tentatively calling the equivalent of Samba on Windows. It is often manifested as a view of computers and shared directories, printers, and files in the Network Neighborhood.
I could mention Netbeui and similar older things, maybe I will have to (or at least Netbios (names)), but I'll try to avoid that for the time being. Suffice it to say (maybe) that at one time Windows networking did (and still could) use a different protocol (Netbeui), but it now pretty much uses the TCP/IP protocol, the same one that is used, for example, on the Internet. Odd things like using Netbeui over TCP/IP are possible, AFAIK, and maybe even are in use somewhere. If you're in that situation you may have a little more to learn, and you will need some other resources. Even so, I'd like to think, that if I get this document finished and "polished" enough to be easily readable/digestible, reading it will be of benefit to you, if for no other reason than to see how the other half lives.
smb, Samba
As discussed above, I call the networking that is the subject of this document "Microsoft" or "Windows" networking in the Windows world.
A suite of programs has been written in Linux to allow Linux computers to participate (or control) those Windows networks.
Andrew Tridge, the person that reverse engineered the Windows networking protocol and wrote the (first versions of that) suite of programs decided to call the suite of programs "Samba". Some of the inspiration for that name came from the fact that one of the protocols the networking is based on in Windows is called smb (for Server Message Block), and Andrew thought (and did some dictionary research looking for words that included the letters smb) that Samba would make a good name.
directory hierarchy
It may be helpful to your understanding if you have a little bit of an understanding of the difference between the way Windows names directories (aka folders) and the way Linux names directories... (single rooted vs. multiple rooted tree structure, disk designations vs. no disk designations).
share (and "share name")
"Share" (as a noun) seems like a rather innocuous and possibly self-explanatory term, but it took me a while to understand what it really meant, so let me share with you my current understanding, using perhaps a few examples.
In general, a share is what is shared by a server. You can share a file (or directory, or disk partition or drive, whatever) or a printer (and maybe some other things, now or in the future). (See also UNC, below.)
When you go to share a file, directory, printer, or whatever in the smb.conf, you have the opportunity (and obligation) to give it a name. _In most cases, you can't give it quite the same name that it uses in it's native environment, so you give it a special name, the share name, or usually just "share" for short.
Here's a (partial example) of the setup of a share in smb.conf (i.e., Linux) and the use of that share in konqueror:
In smb.conf (on a computer with the name of sys12):
[Back]
path = /back
writable = yes
On a different computer (sys5), if everything goes well (more discussion later), I can access that directory in konqueror as:
smb://sys12/Back
(The //sys12/Back is an example of a UNC name, see below.)
(Automatically) shared home directories (see home directories) are automatically given share names based on their user name--for example, my home directory on sys12 (/home/rhk) is accessible with the share name rhk (i.e., UNC //sys12/rhk) which I did not have to specify.
Home directory
*nix (see *nix) computers are very much predicated on networking and multiuse (use of a single computer by multiple users). Because the typical *nix computer is set up to handle multiple users (including "normal" users and a privileged user (the administrator) known as "root" or (imho, less correctly) as the "superuser"), the concept of a home directory for each user came into being. Under the /home hierarchy, there are directories for (most real) users in the system. As my user name is usually rhk, my home directory is /home/rhk.
Home directories typically store configuration information and what I distinguish as "real data" (i.e., files, documents, email, music files, drawing and picture files). (The current best known (imho) paradigm for Windows handling of configuration data is the registry, although dos/Windows has and does use other venues to store configuration data, often depending on the program, and including configuration files something like the typical *nix approach.) The configuration information is often stored in hidden files or directories (in Linux, a hidden file (or directory) is created by using a filename with a period (".") as a prefix), the "real data" is usually stored in non-hidden files, although there are a few exceptions that I know about: kmail (by default, iiuc, stores email in the hidden .Mail directory (for me, /home/rhk/.Mail, or using a common *nix shorthand ~/.Mail), and many browsers store their history, cookies, cache, and similar in amongst the hidden files. (konqueror stores cookies in ~/...). (BTW, "~" is a "real" Linux abbreviation, in the sense that, for example, you can do a "cd ~" to get to your home directory. Linux has other similar abbreviation / shortcuts (that might make the subject of another article).
Asides (as if I'm not already far aside from the basic subject of Samba):
I wish (although the three members of my local lug who have responded to me so far don't agree) that there were more similar hierarchies, so that configuration and "real data" (and maybe some other categories of information, "personal" temporary information (browser cache, history, and cookies?) were stored in separate directories. I.e., /home/ might become the repository (place) for what I call real data, perhaps /config/ might become the repository for (personal) configuration information, /tmp/ might become the place for temporary stuff (like browser cookies, cache, and history), and maybe even /bin/ for "personal" programs, and each of those (most of those?) with their own single character shortcut similar to "~".
I expect that to be a controversial wish, certainly here I am not trying to list the pros and cons of such a change. Some of the cons (or drawbacks to be addressed) are that, just like /home/ gives, by default, more privileges to the owner (i.e., the user(name)) of the (sub)directory, so should those other hierarchies do the same for the subdirectories by their owner (rewrite time).
Another consequence (or design approach) of *nix as a consequence of being designed for multiple users is a "distributed" approach to configuration. Configuration data that applies to the entire machine (and/or all users) is generally maintained in one location (under the /etc hierarchy) while configuration data that does (or can) vary for each user is in more personal locations, i.e., /home/. I guess the Windows registry does something similar by having "registries" that apply to the entire computer and others that apply to separate users (I never became that familiar with the registry).
*nix
Linux is in some sense a clone (or copy, or modeled after) the (earlier) operating system Unix. They share very many similarities. Hence, *nix has developed as a shorthand to refer to Linux and/or Unix.
Auto-magical
Sort of a Linux/hacker based slang used to refer to things that may actually be done automatically but also perhaps done by something/someone else so that you, from your perspective, don't have to worry about how it's done or any of the details. (Does it really add anything (or is it really different than automatic? Even if not, I may want to include it just so there is a definition in case someone runs across it elsewhere.)
For someone else (the person who actually does / takes care of what is required), the effort may be significant (i.e., far from automatic).
UNC (Universal Naming Convention)
Not sure where it came from, and note that it is different and not related (AFAIK) to URLs (Universal Resource Locator) or URIs (Universal Resource I???), but it is a "universal" (therefore, you must have known about it before reading this convention for naming computers and "things" (files, directories, printers, on those computers), usually when those things are referred to or accessed over (via) a network (i.e., remotely).
A typical UNC name looks like this:
//sys12/Back
where sys12 is the (netbios??, host) computer name and Back is the designation for a "share" on that computer. (Hmm, now that I think about it, maybe the computer name can be any of several--it seems that when I set up a share on a client (e.g. smbmount) (copy the results here), samba goes through several steps (approaches) to resolving the name.
Aside: I don't think (test) that the share name is case sensitive (or maybe there is a configuration option)--in general, if it is, I will convert the share to lower case just because I prefer to have most filenames all lowercase (I do make (wisely or not so wisely) some exceptions. For now, I hope the uppercase B (Back) will help the reader distinguish between the share(name) (Back) and the actual file path on sys12 (/back), note that, in general, you can't use the file path name as the sharename--this is a special case because they are both (almost) the same (if you ignore the leading /).
A file somewhere in /back on system 12 (for example, /back/documents/appointments.txt) would be accessed (using the UNC) as //sys12/Back/documents/appointments.txt.
At some point (below) we will talk about mounting shares locally (using smbmount, mount -t smbfs, or /etc/samba) by which means we can access that same file by other (non UNC) paths. For example, we might mount //sys12/back on sys5 as (for example) /sys12back, and then access that file as /sys12back/documents/appointments.txt. (If we really want to confuse the issue, we could actually mount it //sys12/back and then access the file as /sys12/back/documents/appointments.txt, or mount it as just /back (if there is no /back on sys5) and then access it as /back/documents/appointments.txt, or mount it as /mnt/sys12/back and then access it as /mnt/sys12/back/documents/appointments.txt--you should think about these options an others (as wild as your imagination might run) and then try to pick an approach that will be least confusing to you (and any others that might be sharing that computer (or other computers on the network which you might set up in similar fashion)--for me, I think I'll like the /sys12/back mountpoint--I save a few characters vs. /mnt/sys12/back, and I preserve a distinction / separation of the computer vs. the share (and avoid some redundancy) as opposed to names like /sys12back (and then possibly /sys12rhk, etc.).
Copyright � 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors. Ideas, requests, problems regarding WikiLearn? WebBottomBar">Send feedback
See TWiki's New Look