Samba is a Local Area Network (LAN) file sharing service for Linux and Unix.
To download the Samba pages need run the following line.
sudo apt-get install libcups2 samba samba-common
After the packages are loaded we need to edit the Samba configuration file. To do that we will use the text editor nano.
nano /etc/samba/smb.conf
In the global section, remove the “#” at the beginning of the line security = user so that it looks like this:
[...]
# "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
# in the samba-doc package for details.
security = user
[...]
This enables Linux system users to log in to the Samba server.
Close the file and restart Samba.
Adding Samba Shares
If you have not already determines a share directory you may wish to create generic share for system user accounts.
mkdir -p /home/shares/allusers
Next adjust the owner of directory and all the files and subfolders for the directory share
chown -R root:users /home/shares/allusers/
Now you can set the user permissions for all the files and subfolders for the directory share
chmod -R ug+rwx,o+rx-w /home/shares/allusers/
Now we can edit the Samba configuration file to set up the share.
vi /etc/samba/smb.conf
Add the following lines of code to the end of the smb.conf file
[allusers]
comment = All Users
path = /home/shares/allusers
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
writable = yes
You may want to also add a line to the configuration to limit which users have permission to write to file
write list = userX
Next restart the Samba service to load you changes.
Managing Users
Setting the user account up
Before adding users to Samba you must add them to the system. Do this by running the useradd command. Then the user name. Followed by -m -G. Lastly the name of the group. In this case users
useradd userX -m -G users
Set the user account password
Now that we have created a user account we need to set a password for said account.
passwd userX userY
Adding the User Account to the Samba User Database
Now we can add the user to the Samba database. You will be prompted to create a password for the Samba account. In most cases you want the system user account password and Samba password to be the same.
smbpasswd -a userX
Connection to a Samba Share
Windows
To connect to a Samba share you will need to open the Windows Explorer program. In the address bar type \\ and the IP address of the machine you are trying to connect to.
\\10.0.0.11