Table of Contents
With no introduction here is samba install
sudo apt-get install samba samba-common-bin smbclient
Create your shared directory
We’re going to create a dedicated shared directory. You can put it anywhere, but ours will be at the top level of the root file system.
sudo mkdir -m 1777 /share
This command sets the sticky bit (1) to help prevent the directory from being accidentally deleted and gives everyone read/write/execute (777) permissions on it.
Configure Samba to share your new directory
Samba Config files
Edit Samba’s config files to make the file share visible to the Windows PCs on the network.
sudo nano /etc/samba/smb.conf
In our example, you’ll need to add the following entry:
[share] Comment = shared folder Path = /share Browseable = yes Writeable = Yes only guest = no create mask = 0777 directory mask = 0777 Public = yes Guest ok = yes
This means that anyone will be able to read, write, and execute files in the share, either by logging in as a Samba user (which we’ll set up below) or as a guest. If you don’t want to allow guest users, omit the guest ok = yes line.
You could also use Samba to share a user’s home directory so they can access it from elsewhere on the network, or to share a larger external hard disk that lives at a fixed mount point. Just create a smb.conf entry for any path you want to share, and it’ll be made available across your network when you restart Samba.
Create a user and start Samba
Before we start the server, you’ll want to set a Samba password – this is not the same as your standard default password, but there’s no harm in reusing this if you want to, as this is a low-security, local network project.
sudo smbpasswd -a samba-user
Then set a password as prompted. Finally, let’s restart Samba:
sudo service smbd restart
From now on, Samba will start automatically whenever you power on your Pi. Once you’ve made sure that you can locate your shared folder on the network, you can safely disconnect the mouse, monitor, and keyboard from your Pi and just leave it running as a headless file server.
Connect Samba to Shared folder
Change $user to your user
smbclient //192.168.1.185/guild -U $user
Now if it works then you can mount X shared folder to whatever location you want
mount -t cifs -o user=$user //192.168.1.185/guild /media/serverTest