How to install and configure samba setup in Linux mint - 18.3
To install and configure samba setup in Linux Mint 18.3
Samba is a suite of Unix application provide secure, stable and fast file and print service between cross-platform for Windows and Linux. The Samba is standard service of every Unix-like operating system. In this service using an SMA (Server Message Block), and CIFS (Common Internet File System). It is so simple to install and configure Samba on Linux Mint and this tutorial covers the ground on the same process.
Installing Samba
First, make sure you update your system by making use of the following command.
linuxhelp user # apt-get update
Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:2 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:3 http://archive.canonical.com/ubuntu xenial InRelease
Ign:4 http://packages.linuxmint.com sylvia InRelease
Hit:5 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:6 http://packages.linuxmint.com sylvia Release
Hit:8 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Reading package lists... Done
Once it is done, you need to download the samba setup with the help of the following command.
linuxhelp user # apt-get install samba -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libsmbclient libwbclient0 python-dnspython python-ldb python-samba python-tdb samba-common samba-common-bin samba-libs smbclient
Suggested packages:
bind9 bind9utils ctdb ldb-tools smbldap-tools winbind heimdal-clients
Recommended packages:
samba-dsdb-modules samba-vfs-modules
The following NEW packages will be installed:
python-dnspython python-ldb python-samba python-tdb samba samba-common-bin
The following packages will be upgraded:
libsmbclient libwbclient0 samba-common samba-libs smbclient
5 upgraded, 6 newly installed, 0 to remove and 272 not upgraded.
Need to get 8,244 kB of archives.
After this operation, 21.5 MB of additional disk space will be used.
.
.
Processing triggers for systemd (229-4ubuntu21) ...
Setting up samba-common (2:4.3.11+dfsg-0ubuntu0.16.04.12) ...
Setting up libwbclient0:amd64 (2:4.3.11+dfsg-0ubuntu0.16.04.12) ...
Setting up samba-libs:amd64 (2:4.3.11+dfsg-0ubuntu0.16.04.12) ...
Setting up libsmbclient:amd64 (2:4.3.11+dfsg-0ubuntu0.16.04.12) ...
Setting up smbclient (2:4.3.11+dfsg-0ubuntu0.16.04.12) ...
Setting up python-dnspython (1.12.0-1) ...
Setting up python-ldb (2:1.1.24-1ubuntu3) ...
Setting up python-tdb (1.3.8-2) ...
Setting up python-samba (2:4.3.11+dfsg-0ubuntu0.16.04.12) ...
Setting up samba-common-bin (2:4.3.11+dfsg-0ubuntu0.16.04.12) ...
Setting up samba (2:4.3.11+dfsg-0ubuntu0.16.04.12) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for systemd (229-4ubuntu21) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
You should now check the status of Samba service by running the following command.
linuxhelp user # systemctl status smbd
● smbd.service - LSB: start Samba SMB/CIFS daemon (smbd)
Loaded: loaded (/etc/init.d/smbd bad vendor preset: enabled)
Active: active (running) since Wed 2018-03-07 16:38:06 IST 27s ago
Docs: man:systemd-sysv-generator(8)
CGroup: /system.slice/smbd.service
├─15577 /usr/sbin/smbd -D
├─15580 /usr/sbin/smbd -D
└─15583 /usr/sbin/smbd -D
Mar 07 16:38:05 linuxhelp systemd[1]: Starting LSB: start Samba SMB/CIFS daemon (smbd)...
Mar 07 16:38:06 linuxhelp smbd[15561]: * Starting SMB/CIFS daemon smbd
Mar 07 16:38:06 linuxhelp smbd[15561]: ...done.
Mar 07 16:38:06 linuxhelp systemd[1]: Started LSB: start Samba SMB/CIFS daemon (smbd).
Once it' s done, you need to run these commands to create a Directory.
linuxhelp user # mkdir /home/user/share1
linuxhelp user # mkdir /home/user/share2
In order to change permission for created Directories run the below commands.
linuxhelp user # chmod 777 /home/user/share1
linuxhelp user # chmod 777 /home/user/share2
And you need to create new user as follows.
linuxhelp user # useradd user1
linuxhelp user # useradd user2
And add those users to Samba service
linuxhelp user # smbpasswd -a user1 New SMB password: Retype new SMB password: Added user user1. linuxhelp user # smbpasswd -a user2 New SMB password: Retype new SMB password: Added user user2.
Now, open Samba configuration file.
linuxhelp user # vim /etc/samba/smb.conf
And add the following line in the end of the file
[share1] path = /home/user/share1 valid users = user1, user2 read list = user2 write list = user1 browsable = yes [share2] path = /home/user/share2 valid users = user1, user2 read list = user1 write list = user2 browsable = yes
Now, you need to test the configuration by making use of the following command.
linuxhelp user # testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
WARNING: The " syslog" option is deprecated
Processing section " [printers]"
Processing section " [print$]"
Processing section " [share1]"
Processing section " [share2]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
# Global parameters
[global]
server string = %h server (Samba, Ubuntu)
server role = standalone server
map to guest = Bad User
obey pam restrictions = Yes
.
.
[share1]
path = /home/user/share1
valid users = user1 user2
read list = user2
write list = user1
[share2]
path = /home/user/share2
valid users = user1 user2
read list = user1
write list = user2
And then, you need to restart the samba service.
linuxhelp user # systemctl restart smbd
Also, make sure you check the IP address.
linuxhelp user # ip a
1: lo: < LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: < BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
link/ether 00:0c:29:2c:09:18 brd ff:ff:ff:ff:ff:ff
inet 192.168.7.235/24 brd 192.168.7.255 scope global ens33
valid_lft forever preferred_lft forever
inet6 fe80::2eee:9351:a80:8716/64 scope link
valid_lft forever preferred_lft forever
Now, open the Windows machine.
And open Run prompt and type Server IP address (Samba).
And open the sharing files.
Open a Share1 folder due to give the user1 credential.
To create new Folder inside the Share1 Directory.
Open Share2 Directory with the same user1 credential, Here I am trying to make a new Folder.
It will ask you permission to perform this action.
So, open run prompt and type “ temp.”
Delete all the files inside that folder.
Again, open the run prompt and type “ %temp%” in it.
Delete all the files inside that folder.
Once again go back to the run prompt and type cmd
In the command prompt, type the following command to remove current samba user credential (user1).
Here press “ y” to proceed with the process.
To open Run prompt and type Server IP address (Samba).
The sharing folders now appear.
Open share1 Directory with “ user2” credential.
Here trying to make a new folder.
A message is shown asking you for permission to perform this action.
To open Share2 Directory
To try to make a new Folder
To folder is created successfully
Comments ( 3 )