Samba

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Revision as of 16:14, 9 February 2006 by Woozle (talk | contribs) (→‎How To: issues section)
Jump to navigation Jump to search

Computing: Linux: Samba

Samba is a program which allows "Network Neighborhood"-style communication between Linux and Windows. It is named after the SMB protocol, which is what Windows uses for "Network Neighborhood" communication.

Commands

Related Articles

Issues

It can be extremely difficult to get Samba to work in certain ways; there really needs to be some kind of error log so that when you (for example) attempt to connect to a share and are refused, you can find out exactly why Samba refused the connection – something like this:

  • Connection refused: Remote Samba user sambaguest requested connection to this server (Samba name: floyd) and was refused because (fill in the blank)
  • Permission denied: Remote Samba user sambaguest attempted to create file in local resource /home/harena/share shared as harena and was refused because (fill in the blank)

The log could be turned off by default if it was too resource-intensive for normal use.

How To

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, 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.

Get DNS to Recognize NetBIOS Names

I haven't actually figured this one out yet; I've seen several workable solutions, but they all seem hideously complicated. This shouldn't be a difficult problem.

One possible phrasing of the problem, for purists: How can we add {NetBIOS's knowledge of machine names on the network} to the available domain space? 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.

One useful bit of information: the command nmblookup will accept a NetBIOS name and return an IP address.

Reference

Links