Category Archives: tutorials

Install Samba Server on Raspberry Pi to access over network

1-
sudo apt-get install samba samba-common-bin

2-
The directory that we will share out will act as a mount point for external storage. So we will need to create the directory and set appropriate permissions to the directory. Using mkdir(/bin/mkdir) we can both create the directory and set the permissions in the one command. The -m option will allow you to set the mode or permissions of the directory.

sudo mkdir -m 1777 /data

From the above command we can see the easy part, creating the directory /data. As it is at the root of the file-system we will need administrative permissions to do this so we run it prefaced with the sudo command. The mode of the directory is set with the -m option:

1: sets the sticky bit. This set on a directory ensures that users can only delete files they own.
7: sets RWX read , write and execute for the user owner
7: sets RWX read , write and execute for the group owner
7: sets RWX read , write and execute for others
This directory will be empty at the moment and, of course, the root file-system is limited in size on the Pi to that available from the SD cards. We can use an external drive connected to the USB ports and have this mounted to the /data directory. This then can provide effective storage for your network

3-
Backup conf file and edit as following;
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.old
sudo rm /etc/samba/smb.conf
sudo nano /etc/samba/smb.conf

Add the following lines;
[global]
workgroup = HOME
netbios name = KINETIC
server string = Kinetic Server %v
map to guest = Bad User
log file = /var/log/samba/log.%m
max log size = 50
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
preferred master = No
local master = No
dns proxy = No
security = User

wins support = yes

[Data]
comment= Pi Home
path=/home/pi
browseable=Yes
writeable=Yes
only guest=no
create mask=0777
directory mask=0777
public=yes

4-
Restart Samba Server
sudo service smbd restart
sudo service nmbd restart

5-
Create users
The last part of this tutorial will involve us creating samba users. These users must represent Linux users but their password can and should be different to the Linux password for security. This is not enforced though. Using the command smbpasswd(/usr/bin/smbpasswd) as the root user we can add new samba users. A user must have a password in samba to access shares.

sudo smbpasswd -a root
sudo smbpasswd -a pi

6-
Restart Samba Server
sudo service smbd restart
sudo service nmbd restart

Access Raspberry Pi over your network

RaspberryPi_Logo1- Plug Raspberry Pi to HDMI, keyboard, network cable (cat5) SD card with the OS

2- connect PU 5 volt 2.1 amp

3- Select Rasbian OS to install

4- Wait for the installation to finish

5- If everything is ok, you should see a screen as follows

16- Now, you can plug off your HDMI cable.

7- Open Terminal in your Mac OS X.

8- Find the ip of your Raspberry Pi from your router’s GUI (Type : 192.168.x.x – whatever yours…Login and find a menu named LAN. Right there, you should see the local ip address of your Raspberry Pi – e.g. Mine is 192.168.2.34)

9- In terminal window type as follows to connect your Raspberry Pi with SSH over network:
ssh pi@192.168.2.34

Screen Shot 2015-01-25 at 21.55.56

pi is the default username and raspberry is the default password of your Raspberry Pi. Hit the Return and enter the password.

You should see something like this:

Screen Shot 2015-01-25 at 21.56.09

10- Now, type sudo raspi-config sudo is for administrator
authorization.
1

Move the cursor to the Advanced Options hit Return. Then move cursor to SSH hit Return. Enable it.
SSH
Screen goes black and the it says “SSH enabled”. Hit OK.

11- If you mind to use your Raspberry Pi as a NAS only, you don’t need much GPU power. So, it’s better to make it lower. Goto Advanced Options->Memory Split. Type the lowest value which is 16 and OK.
GPU

12- Few commands to use with your Raspberry Pi over network;
sudo halt – to shutdown
sudo reboot – to restart