Sharing With Samba
To set up file sharing using the samba service, I’m following a howto guide on the Ubuntu Forums. Here’s the basic steps without all the exposition in the guide (with the assumption that I just want to share a folder /s with myself and no one else):
Install samba:
$ sudo apt-get install samba
Stop samba:
$ sudo /etc/init.d/samba stop
Backup samba configuration file template, then create and edit a new configuration file:
$ sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.template
$ sudo touch /etc/samba/smb.conf
$ sudo gedit /etc/samba/smb.conf
Paste in:
[global]
; General server settings
netbios name = ezmac
server string =
workgroup = WORKGROUP
announce version = 5.0
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192
passdb backend = tdbsam
security = user
null passwords = true
username map = /etc/samba/smbusers
name resolve order = hosts wins bcast
wins support = yes
printing = CUPS
printcap name = CUPS
syslog = 1
syslog only = yes
[s]
path = /s
browseable = yes
read only = no
guest ok = no
create mask = 0700
directory mask = 0700
force user = ez
force group = ez
Start samba:
$ sudo /etc/init.d/samba start
Add myself as a samba user and activate:
$ sudo smbpasswd -L -a ez
$ sudo smbpasswd -L -e ez
That’s all it takes to be able to login from other computers and have full access to the files in /s. But I also want to be able to mount shares being served from the other computers on my network. For that I run:
$ sudo apt-get install smbfs
then to mount a network share I run:
$ smbmount //XX.XX.XX.XX/share /path/to/mount/point
and unmount with:
$ smbumount /path/to/mount/point
where XX.XX.XX.XX is the local ip address of the server, share is the name of the network share, and /path/to/mount/point is obviously the path to the mount point. In gutsy I could use the server name instead of the ip address, but that is not working for me now. I did some research and tried some things, but nothing worked so I’ll just do it this way for now (fortunately all of my computers have static local IP’s anyway).
UPDATE: I am now able to access my shares by server name after adding the static ip address and server name to the file /etc/hosts. Not sure how useful that is, since I still have to know the ip address and it has to be static, but this does work.
In addition to the guide I was following, I looked at a review of the ‘create mask’ and ‘directory mask’ options here and scanned some parts of Using Samba, 2nd Edition by Jay Ts, Robert Eckstein, and David Collier-Brown (this book is an awesome resource, read it).