Samba: Difference between revisions

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
m Automatic resolution of Network Neighborhood names: no further changes needed; testing procedure
No edit summary
 
(26 intermediate revisions by the same user not shown)
Line 1: Line 1:
=={{hide|navbar}}==
<hide>
[[computing]]: [[software]]: [[Samba]]
[[page type::article]]
==Overview==
[[thing type::software]]
[[Samba]] is a program which allows "[[Network Neighborhood]]"-style communication between Windows and other platforms such as [[Linux]]. It is named after the SMB protocol, which is what Windows uses for "Network Neighborhood" communication.
[[software type::server]]
==Commands==
[[category:software]]
* '''User commands'''
</hide>
** [[net (Samba command)|net]]
==About==
** [[nmblookup]]
[[Samba]] is open-source server software which allows "[[Network Neighborhood]]"-style communication between [[Microsoft Windows]] and other [[operating system]]s such as [[Linux]]. It is named after the [[SMB protocol]], which is what Windows uses for "Network Neighborhood" communication.
** [[smbclient]]
==Pages==
** [[smbpasswd]]
* {{l/sub|browser}}: debugging master/domain browser issues
** [[testparm]]
* {{l/sub|commands}} for interacting with Samba
* '''System commands''' (not usually run by the user)
* {{l/sub|how-to}}: specific things
** [[smbd]]: the Samba [[daemon]]
* {{l/sub|printing}}: using Samba to serve shared printers
** [[nmbd]]: the NetBIOS name servernmbd [[daemon]]
* {{l/sub|files}}: what the files mean and where they are kept
 
==Errors==
==Related Articles==
* [[The list of servers for this workgroup is not currently available]]: a Samba-related error on Windows XP
* '''files'''
** [[smb.conf]]: the Samba configuration file
** [[smbusers]]: the Samba users file
==How To==
===Debug connection/access issues===
Samba maintains activity logs in /var/log/samba/. There seem to be two logs, log.nmbd and log.smbd; log.smbd generally has information about connections and access, while log.nmbd has more to to with network-name resolution. The nature of the log files is configurable somewhat through [[smb.conf]] (see '''log level''', among others). Use '''[[tail (command)|tail]] -f /var/log/samba/log.smbd''' (for example) to monitor a logfile in real-time.
 
===Restart the Samba Server===
If you have Fedora Core, there's a convenient little "services" application you can use to restart Samba and several dozen other services. For the rest of us, however, there's a command you have to execute from a root terminal.
 
On [[Ubuntu]], and probably other [[Debian]]-based systems:
[[sudo]] /etc/init.d/samba restart
On [[SuSE]] 10.0 and [[Fedora Core]] 4:
[[sudo]] /etc/init.d/smb restart
 
This will ask for a password; type in your password (not root's) unless you have reconfigured your sudo setup. (This assumes you have sudo privileges; if not, [[su]] to get root access and then type the rest of the command without the "sudo".)
 
On [[Red Hat Linux|Red Hat]], I'm told the command would be:
/sbin/samba restart
 
(Possibly substituting "smb" for "samba"; ls the directory in question to find a list of services.) This is the same general technique used for restarting services, which should itself probably be documented somewhere. (The Samba share configuration GUI program really ought to have a "restart Samba server" button, though, even if it does this automatically when you change parameters -- because there is no way to know if it is doing this otherwise.)
 
===Configure Samba for "guest" logins===
As most home operating systems are now moving towards requiring users to have login accounts, this is becoming less necessary -- but it is still useful under some circumstances (such as wanting to give access to Win9x machines with the login dialogue bypassed).
 
Configuration for [[smb.conf]]:
 
In the [global] section:
# Causes Samba to act as WINS server, which turns network names into IP addresses.
wins support = yes
# Causes Samba to act as Local Master Browser
# (This can help prevent conflicts between XP and 9x, where XP tends to take over and refuse access to non-XP systems)
local master = yes
# These may or may not be important, but it's how my system is set:
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
winbind uid = 16777216-33554431
winbind gid = 16777216-33554431
 
guest account = sambaguest
password server = None
guest ok = yes
security = SHARE
username map = /etc/samba/smbusers
 
# these options help to prevent permissions conflicts
# (where the "sambaguest" user creates files which (by default) nobody else can write or delete)
force group = lanusers
force create mode = 0060
create mask = 0775
 
I haven't tested these to see if these options are all helpful or if there are other options which are necessary; this is just a first pass based on a combination of (vague) understanding and actual experience.
 
After editing and saving smb.conf. restart the Samba daemon for changes to take effect.
 
Tentative explanation of "guest" status: SMB has the concept of a "guest account", which is what Win9x uses by default when connecting via SMB (if you set up user logins, then I think it uses the actual username, but I haven't tested this); the "guest account" setting is the user which Samba appears to be when the SMB "guest account" is accessing files. In other words, for example: files created by a SMB "guest account" will appear on a Linux system as created by "sambaguest". If the "force group" setting is used, then those files will also be owned by the specified group.
===Automatic resolution of Network Neighborhood names===
(I researched this extensively for many months, but all the solutions I found were either hideously complicated or somehow inadequate. The solution turns out to be quite simple.)
 
Some explanation, for technical purists:
* '''Problem''': How can we add [[Network Neighborhood]] machine names to the search space used by [[Linux]]'s [[domain name resolver]]?
* '''Justification''': This is needed so that commands which accept a domain name as input (e.g. ftp, ssh, mysql) can accept a machine name instead, removing the necessity to manually look up the machine's IP address. For example, I should be able to type '''ssh <u>machinename</u>''' instead of having to first look up <u>machinename</u>'s IP address via other methods, and then paste or retype that address (both methods prone to error) after the ssh command.
 
The solution:
* install [[winbind]] (usually available in standard repositories; Ubuntu has it)
* edit /etc/[[nsswitch.conf]]
** change the "hosts" line to include "wins" before "dns".
 
This tells Linux's [[domain name resolver]] to check [[WINS]] before it checks [[DNS]] when resolving domain names. No further action should be required; test the change by trying to ping a local machine by name.
====related useful information====
The command '''{{linuxcmd|nmblookup}} <u>machinename</u>''' returns an IP address, as will '''{{linuxcmd|net}} lookup <u>machinename</u>'''. nmblookup apparently sends out a broadcast request ("anyone here named <u>machinename</u>?"), while net lookup checks a central list (presumably on the Samba master browser).
 
====notes====
[[WINS]] is a method of [[domain name resolution]], as is [[DNS]]. [[WINS]] (a protocol) originally used [[NetBIOS]] (another, lower-level protocol), but more recently has switched to using [[TCP]].
 
==Reference==
*[[Wikipedia:Samba software]]
*[[Wikipedia:Server Message Block]]: SMB protocol
==Links==
==Links==
* [http://searchopensource.techtarget.com/tip/1,289483,sid39_gci1138772,00.html Managing Samba: Choose your weapon -- Windows network ID basics]: seems to cover some useful concepts
===Official===
* [http://samba.org official site]
===Reference===
* '''Wikipedia''':
** {{l/wp|Samba software}}
** {{l/wp|Server Message Block}}: the SMB protocol
===Articles===
* '''1999-11''' [http://www.oreilly.com/catalog/samba/chapter/book/ch03_01.html Chapter 3: Configuring Windows Clients] from the book ''Using Samba'' by Robert Eckstein, David Collier-Brown, Peter Kelly (this shows how to set up [[Win9x]] machines for non-anonymous connection to Samba)
* [http://searchopensource.techtarget.com/tip/1,289483,sid39_gci1138772,00.html Managing Samba: Choose your weapon &ndash; Windows network ID basics]: seems to cover some useful concepts

Latest revision as of 15:34, 16 September 2024

<hide> page type::article thing type::software software type::server </hide>

About

Samba is open-source server software which allows "Network Neighborhood"-style communication between Microsoft Windows and other operating systems such as Linux. It is named after the SMB protocol, which is what Windows uses for "Network Neighborhood" communication.

Pages

  • browser: debugging master/domain browser issues
  • commands for interacting with Samba
  • how-to: specific things
  • printing: using Samba to serve shared printers
  • files: what the files mean and where they are kept

Errors

Official

Reference

Articles