1 Apr 2013

Crunchbang Linux - simple file sharing with Samba

Crunchbang Linux is a slim down operating system that works well on older computers. I wrote a previous article about it and how I installed it on an old IBM T42 (with just 512MB RAM!) and a little Asus Eee PC. Crunchbang is great for browsing the web and other light work. Another thing you could do is set up file sharing on your Crunchbang computer. This is especially useful if you have an old desktop with a reasonably sized hard disk. You could use it to share files on your home network or you could use it to store files as a backup.

In this article I'll explain how to set up a simple file share on your Crunchbang computer. We'll use Samba which is the most popular file sharing software for Linux. The commands used here can be used in other Linux operating systems too. I will not go into detail and will explain only the basic steps to get simple file sharing working.

At the end, from your Windows computer you'll be able to browse to and save/open files on your Crunchbang Linux computer.


Crunchbang Linux
To download and install Crunchbang please see my previous article:
http://mgxp.blogspot.ch/2013/03/crunchbang-linux.html


Install Samba
Go to your Crunchbang Linux computer, start it and login as usual.
Right click on the desktop and click Terminal

At the $ prompt type:
sudo apt-get install samba libpam-smbpass [Enter]

Samba will download and install. It will ask you for the name of the network workgroup:


Unless you've changed it, accept the default "WORKGROUP".


Configure File Sharing
Change to the srv folder, type:
cd /srv  [Enter]


Create a new folder called share:
sudo mkdir share
  [Enter]



This sets the permissions for the share folder to full read/write:
sudo chmod 777 share/ 
[Enter]


Make a backup copy of the original Samba configuration file, this is just in case you need it for future reference:
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.original  [Enter]


Edit the Samba configuration file:
sudo geany /etc/samba/smb.conf  [Enter]

The Geany text editor will open the smb.conf file. Replace all the content of the file with the following:

[global]
disable netbios = no
workgroup = workgroup
server string = fileserver
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
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
security = user
username map = /etc/samba/smbusers
load printers = no
printing = bsd
printcap name = /dev/null
disable spoolss = yes

[share]
path = /srv/share
writeable = yes
browseable = yes
create mask = 6777
directory mask = 6777



NOTE:

  • The "workgroup=" parameter is set to "workgroup", this is the default name of the Windows network you are connecting to. If your workgroup name is different, change it here.
  • The "server string=" parameter can be anything. It should be something descriptive for this computer. If there are two Linux computers configured with the same "server string=" name, one of them will not appear when you look for it from your Windows computer. Therefore, make sure the "server string=" name is unique on your network.


Save and exit the text editor (Geany).

At the $ prompt enter the following to restart Samba:
sudo /etc/init.d/samba restart  [Enter]

Wait for 30 seconds.


On the Windows computer
Go to your Windows computer, browse in Windows Explorer to your Network, browse under Microsoft Windows Network and Workgroup - you should see your Crunchbang computer appear in the list.


In the above example from a Windows XP computer you can see I've found my Crunchbang computer. In brackets you can see it says "Crunchbangt42" - this is the host name of my Crunchbang computer, yours will be different. you can find the host name on your Crunchbang desktop:


On your Windows computer, if you can't find the Crunchbang computer on the network, on the Windows Explorer address bar you can type \\ and the host name directly. In my case I would enter "\\crunchbangT42".

If you are using Windows 7 click Start and enter \\ and the name of the host in the search box. Click on it...

In Windows when you click the share folder you'll be prompted to login:

This is a Windows XP connect box but you will see something
similar for Windows 7 or any other  version of Windows.

Enter your Crunchbang username, password and click OK. If you want this Windows computer not to prompt you for a password next time, click the [ ] Remember my password box.


The above is the result. You can copy files to/from this location.

Finished!



References

The following Youtube video shows in more depth how to set up Samba. My thanks to the author as it what I used as a starting point for this article.
http://youtu.be/P7lvuJdsrMY

Samba
http://www.samba.org/

Crunchbang
http://crunchbang.org/




No comments: