How to configure a samba share in linux

Samba is the networking protocol to allow Windows computers to communicate with linux computers. Today I am using LinuxMint 13 Xfce to setup a share for Windows.
There is a tool for Linuxmint (and other linux distrobutions) called system-config-samba , which allows easy configuration of samba shares , so I will show you how to use that aswell as how to do it without. If it is not already installed use your package manager to install it. Before going any further it will pay to take some time to think about the kind of server you want , will it be server you login to or just everyone on your network has access , I will show you how to do both. First up I’ll show you to step up a share for everyone with read/write access.
The first Step is to open system-config-samba it will look like this,
To select the server type and workgroup option , preferences menu , server settings
Now add a directory (this could be any directory or mountpoint if have an external harddrive), in this example I am using /mnt/Share. It can be done by clicking on the + button
Who has access will depend on the type of server used. For this example I am going to allow everyone access in the access tab as its just a shared directory.
You can do the same thing just by editing /etc/samba/smb.conf as root and using
workgroup = WORKGROUP
security = share
and adding the share should look like
comment = Shared Folder
read only = yes
path = /mnt/Share
guest ok = no
As you can see it is not that difficuilt , however when trying to access the share from Windows you might see something like
Which most of the time its caused by the permissions of /mnt/Share not allow access to the right users/group , I have written before about linux permissions here. To allowing everyone access i would use 666 that would allow the owner/group/others read/write acess so if you wanted everyone to just have read access then 664. Entirely up to what you want.

To setup samba as a per user basis then change the server settings accordingly , then add users in the preferences menu , samba users. You will need to create a linux user for each Windows user. Then you will be able select which windows user will use the corresponding linux user in the create new users tab as shown below
also make sure you allow this user access in the samba share settings

If you are editing the smb.conf then change security = share to security = user. To create a samba user after creating a linux user use smbpasswd -a username. Then alter the permissions on /mnt/Share accodingly to suit your needs.In windows you should now see

And you should be able to log into the share as your user. If you have any problems like i mentioned earlier most of the time its the permissions have no been set on the directory. Here are some useful commands that come in handy.
adduser user
adduser user smbgroup (add user to a group for samba access)
chown -R 666 user:smbgroup /mnt/Share (change ownership based on user:group of /mnt/Share)
smbpasswd -a user (add user to the list of usernames in samba)

These have to be run as root or use sudo ie sudo adduser user

Posted in 01Ben, Computers, Linux, Linux Mint, Windows

Please feel free to leave a reply.

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


Enter your email address to follow this blog and receive notifications of new posts by email.

Join 67 other followers

%d bloggers like this: