There are two different ways to create Samba shares in Linux:
UserShares -- Created from the file manager
ClassicShares -- Created by adding share definitions to smb.conf either directly or using an application.
This HowTo is about Samba Usershares as it has become the default method to create shares on Mint and Ubuntu. UserShare definitions are located in /var/lib/samba/usershares as opposed to /etc/samba/smb.conf in "Classic Samba".
This method is invoked by opening your file manager ( Nemo, Nautilus, Caja ) > right clicking on the directory you want to share > Sharing Options or Properties. Please note that you can only share folders that you own ( i.e., folders in your own home directory or mount points to partitions where you are the owner, for example ) although there are ways around this limitation by open a file manager as root ( gksu nemo ).
This method relies on the following package:
nautilus-share ( on Ubuntu )
nemo-share ( on Mint Cinnamon )
caja-share ( on Mint MATE )
Note: There is no implementation of this in XFCE's file manager but you can create a set of "Thunar Custom Actions" to approximate it using this HowTo: Create Samba Shares Directly from Thunar
(1) Create a Shared Directory - using Mint Cinnamons Nemo file manager as an example
Open Nemo
Right click on the directory you own that you wish to share
Select "Sharing Options"
Select "Share this Folder"
Now you have some decisions to make.
(1a) If you want your users ( or guests ) to have write access then:
Select "Allow other people to write in this folder"
(1b) If you want everyone in your home network to have access to that shared folder:
Select "Guest Access"
(1c) When you click on Create Share a dialog box pops up and asks you if you want it to add permissions automatically - you do.
NOTE 1: If you allow "guest access" you're done. You can skip the rest of
this document ( except for note B mentioned at the end ). Everyone on the
network will be able to Read and/or Write from/to that folder. If you don't
want guest access then you will have to create users with passwords
( explained later )
NOTE 2: If you allow guest access and you are connected directly to the internet
everyone will have access. If you have a home network and are behind a Router
you should be OK since the outside world can't see your individual machine
(1d) If you want username and password authentication before anyone accesses your share then proceed to step (2)
(2) Accessing Shares with Authentication
I will show 2 of the more common scenarios of how that can be done and use the following keys:
altair = Your Mint login name on the machine whose folders you want to share on the network.
agnes = The login name of a remote user who wants access to that share.
File sharing in linux with authentication requires two completely different sets of usernames and passwords.
[] Scenario 1: Accessing the share using the Share Owner's User Name.
Even though the Share Owner already has a login name and password it must also have a "Samba" user name and password:
On the Mint Box with the share:
Open a terminal and run:
Code: Select all
sudo smbpasswd -a altair
[] Scenario 2: Accessing the share using the Remote User's Name
This is more complicated since you can't create a samba user without first creating a new user.
Create a Remote User Name account on the Mint Box with the share:
On the Mint Box with the share:
Menu > Administration > Users and Groups > Add User >
Username: agnes
Password: Can be anything.
NOTE: There is another way to add a new user to the Mint Box with the share if the only reason you're adding it is for share access:
Open Terminal
Type sudo useradd -s /bin/true agnes
This will create a linux user on the server that has no server logon capability and no server home directory.
Then add that user to the samba password database:
Code: Select all
sudo smbpasswd -a agnes
Samba Browsing Problems Checklist
All Linux or Linux / OSX Only Network Browsing
Some notes:
(A) "Guest Access" will not be available unless the line:
usershare allow guests = yes is somewhere in etc/samba/smb.conf. It's included in the default smb.conf as part of the install but if you have written your own it may not be there so you will have to add it back.
Note: On Mint Debian that line is not present in smb.conf by default so it will have to be added and samba ( note in Debian it's samba not smbd ) will have to be restarted:
Code: Select all
sudo service samba restart
Code: Select all
force user = altair
Code: Select all
sudo service smbd restart
(D) The biggest difference between usershares and classic samba is the control of Samba User access. In usershares all Samba Users will have access to all shared directories that require authentication. In classic shares you can dictate exactly what user has access to what share.