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,
sambaconfig
To select the server type and workgroup option , preferences menu , server settings
sambaconfig-settings-workgroupsambaconfig-settings-server-type
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
sambaconfig-create-share
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.
sambaconfig-create-share-access
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
[Share]
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
windows-filemanager-error
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
sambaconfig-create-user
also make sure you allow this user access in the samba share settings
sambaconfig-create-access-user

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
windows-filemanager-login

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

Advertisements
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:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Archives
Categories

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

Join 69 other followers

%d bloggers like this: