Monday, January 18, 2010

Export samba shares in Jolicloud / Ubuntu

I wanted to get samba working on my Jolicloud, and for the novice, it's not just click-and-go (you can't just search for "samba" in the app directory and install it), so I though I'd share how to do it (manually).


My goal was to share my home directory of my Netbook, so I could access it from my desktop, with authentication ofcourse.

First thing you have to do is start a root terminal, you can find it in the main menu under "System Tools". From here you install the samba packages by issuing:
# apt-get install samba

Answer Yes to install samba packages and dependencies.

Second step is to edit the samba configuration file (/etc/samba/smb.conf).

For sharing only your home directory, you can use this configuration file (changing the workgroup name)

[global]
workgroup = WORKGROUP
server string = %h Netbook
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
usershare allow guests = yes
[homes]
comment = Home Directories
browseable = no
read only = no
create mask = 0700
directory mask = 0700

Third, you have to set your samba password by issuing
# smbpasswd yourusername

You will have to enter the same password twice.

Last step is to actually start the samba daemon:
# service samba start

That's it, you should now be able to browse your "Windows network" from another computer by browsing the directory "\\ip.of.your.new.samba.server\username" or use the smbclient command from the terminal:
# smbclient //ip.of.your.new.samba.server/username