Tutorial: Install Samba on raspberry pi

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

Tutorial: Install Samba on raspberry pi

#1 Post by don570 »

It is possible to make the raspberry pi2 into a large but slow server
using the fatdogarm distro.

It should only take a couple minutes by following these instructions
assuming that you have fatdog arm installed already and the software downloaded.

INSTRUCTIONS:

Download and install:
http://distro.ibiblio.org/fatdog/arm/pa ... rmhf-1.tbz
http://distro.ibiblio.org/fatdog/arm/pa ... rmhf-1.tbz


Make sure that the ethernet device is recognized and running --->
I put the following in my cmdline.txt file which is located in /mnt/mmcblk0p1/

Code: Select all

 net=wired:eth0:dhcp
Tip: Type 'ifconfig' in terminal to check if ethernet device is running.
___________________________________________________________

samba4-4.0.15-armhf-1.tbz has already been installed.
It is time to make a configuration file for samba to use.

Copy /etc/samba/smb.conf.default as smb.conf

Code: Select all

cd  /etc/samba
cp  smb.conf.default  smb.conf

To add two shares to the server, Donald and mine
Add to bottom of file smb.conf

Code: Select all

[Donald]
   path = /root/my-documents
   read only = no

[mine]
   path = /root/puppy-reference
   read only = no
I suggest removing the following lines. This section allows each users home directory to be accessible
but this isn't needed.

Code: Select all

[homes]
   comment = Home Directories
   browseable = no
   writable = yes

After making a change to smb.conf, Samba must be restarted
by starting two daemons nmbd and smbd

So I type each in the terminal to start each one

Code: Select all

root:~# nmbd

Code: Select all

root:~# smbd
If there is error

Code: Select all

smbd: error while loading shared libraries: libtirpc.so.1:

then you have forgotten to install libtirpc package.

Install and now 'smbd' can be launched in terminal without a terminal complaint.

I make a Samba user

Code: Select all

smbpasswd -a root
The password I use is 'woofwoof' which is the same as fatdogarm's password
so I won't forget.

Note: A Samba user must also be a computer user.

To test my install I type 'testparm'

It should show that two shares are available to other computers, Donald and mine

Everything checked out fine so Samba is running correctly

Note that workgroup name might be important. I have read that
it should be the same as your windows workgroup name in some
versions of windows.??? In my computer installation it didn't matter.


Now I must find my raspberry pi computer's address on the network

Code: Select all

# ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:a8:cd:57  
          inet addr:192.168.1.101  Bcast:192.168.1.255  Mask:255.255.255.0
ifconfig command provided the address of 192.168.1.101

Alternative method to find address of raspberry pi computer :

I installed a free windows program Advanced IP Scanner
and clicked Scan button. My raspberry pi address is obviously
192.168.1.101 (see image below)

Image

To find the raspberry pi's hostname type 'hostname' in terminal
The reply was 'fatdog64-d41'

Code: Select all

root:~# hostname
fatdog64-d41

With this information I now went to my Windows XP computer.
I right clicked 'Network Places' and chose 'Search'
I filled in 'fatdog64-d41' (or fill in address number if you prefer)

(Samba username and password is needed to connect!!)

I saw that two shares were available. I selected 'Donald'
and made the connection.(See image)

Image

The file server was automatically recognized. Files can be created and changed by
either the linux and Windows user.
For more security you can modify the smb.conf file. There are
lots of sites that have sample files.


You can do a Windows network mapping if you want the drive to appear in
file manager open or save dialogs.

Click 'My Network Places'

Tools > Map Network Drive

Image
____________________________________________________________
The same server can be used by other linux installs along your network.


Now to connect the server to a linux computer...

I ran pnethood in Fluppy linux and saw the computer
'fatdog64-d41' listed. I just had to click the name and then click 'Show'
The Samba user is 'root'
The password is 'woofwoof'
The root folder is now accessible in Fluppy linux.

Image
_____________________________________________________________

YASSM is the other popular method of connecting to a share:

Image

__________________________________________________

Post Reply