My ongoing experiences with Ubuntu, and later Mythbuntu, as a media center with MythTV. I'm also using the system for a virtual machine server, a mediawiki server and a general all around home infrastructure base.

Sunday, September 28, 2008

Installing Samba on Ubuntu Server

Previously I had installed Samba via the Ubuntu desktop, but now I wanted to do it on Ubuntu server.

First, I installed samba:

apt-get install samba

At the end of the install on my VMWare host system, I got the warning below:

The following line will be added to your /etc/inetd.conf file:

## netbios-ssn stream tcp nowait root /usr/sbin/tcpd /usr/sbin/smbd

If you are indeed using xinetd, you will have to convert the
above into /etc/xinetd.conf format, and add it manually. See
/usr/share/doc/xinetd/README.Debian for more information.

I didn't end up having to do anything special, but wanted to mention it anyways.

Next, I edited /etc/samba/smb.conf to look like the one below. (You'll want to replace "username" with an actual username or list of usernames.)

workgroup = WORKGROUP
server string = %h server (Samba, Ubuntu)
# This will prevent nmbd to search for NetBIOS names through DNS.
dns proxy = no

# This tells Samba to use a separate log file for each machine
# that connects
log file = /var/log/samba/log.%m

# Cap the size of the individual log files (in KiB).
max log size = 1000

# Do something sensible when Samba crashes: mail the admin a backtrace
panic action = /usr/share/samba/panic-action %d

# "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server.
security = user
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
invalid users = root
# This option controls how nsuccessful authentication attempts are mapped
# to anonymous connections
map to guest = bad user
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

comment = tmp
path = /tmp
valid users = username
writable = yes
create mask = 0644
directory mask = 0755

You can validate your smb.conf file by running 'testparm', e.g:
# testparm -s
Load smb config files from /etc/samba/smb.conf
Processing section "[music]"
Loaded services file OK.

Restart Samba:
# /etc/init.d/samba reload
* Reloading /etc/samba/smb.conf smbd only

Add samba users via smbpassword:
smbpasswd -a username

That's it.

BTW, one tidbit, if you get "Error code -6602" on the client, this is caused by a non-existent path in /etc/samba/smb.conf.
Post a Comment