Setup Passwordless SAMBA Share in Linux for Windows Server Access

In this article, we will perform the required steps to setup Passwordless SAMBA Share on Linux Server. This can permit everyone on a windows machine to get entry to this without a set off for password. This form of requirement generally comes from the Window application team in which they want an application to get access Linux share drive to store/access files/images from the Linux share drive without prompting for a password.

Please note we will be using OEL (Oracle Enterprise Linux) 7.9 & yum and wget command require internet access in your Linux Server.

[root@test-machine01 log]# cat /etc/oracle-release
Oracle Linux Server release 7.9

Please verify you have already got the OEL7 yum repository, typically OEL yum repository is configured all through the time of OS installation. Use yum repolist command to list presently configure yum repository in your Server.

[root@test-machine01 log]# yum repolist
Loaded plugins: langpacks, ulninfo
repo id                                                              repo name                                                                                                          status
!mysql-connectors-community/x86_64                                   MySQL Connectors Community                                                                                            175
!mysql-tools-community/x86_64                                        MySQL Tools Community                                                                                                 120
!mysql80-community/x86_64                                            MySQL 8.0 Community Server                                                                                            211
!ol7_UEKR6/x86_64                                                    Latest Unbreakable Enterprise Kernel Release 6 for Oracle Linux 7Server (x86_64)                                      204
!ol7_latest/x86_64                                                   Oracle Linux 7Server Latest (x86_64)                                                                               21,673

For some reason, if you are lacking with OEL7 yum repository file, you may get configured it with wget command.

[root@test-machine01 yum.repos.d]# wget http://yum.oracle.com/public-yum-ol7.repo
--2020-12-23 10:14:53--  http://yum.oracle.com/public-yum-ol7.repo
Resolving yum.oracle.com (yum.oracle.com)...
Connecting to yum.oracle.com (yum.oracle.com)||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16402 (16K) [text/plain]
Saving to: âpublic-yum-ol7.repo.1â

100%[====================================================================================================================================================>] 16,402      --.-K/s   in 0s

2020-12-23 10:14:54 (106 MB/s) - âpublic-yum-ol7.repo.1â saved [16402/16402]

Install SAMBA software program using under yum install command.

[root@test-machine01 yum.repos.d]#  yum install samba

  Installing : libtalloc-2.1.16-1.el7.x86_64                                                                                                                                             1/14
  Installing : libtdb-1.3.18-1.el7.x86_64                                                                                                                                                2/14
  Installing : libtevent-0.9.39-1.el7.x86_64                                                                                                                                             3/14
  Installing : libldb-1.5.4-1.el7.x86_64                                                                                                                                                 4/14
  Installing : samba-common-4.10.16-9.el7_9.noarch                                                                                                                                       5/14
  Installing : libwbclient-4.10.16-9.el7_9.x86_64                                                                                                                                        6/14
  Installing : samba-common-libs-4.10.16-9.el7_9.x86_64                                                                                                                                  7/14
  Installing : samba-client-libs-4.10.16-9.el7_9.x86_64                                                                                                                                  8/14
  Installing : python-tdb-1.3.18-1.el7.x86_64                                                                                                                                            9/14
  Installing : pyldb-1.5.4-1.el7.x86_64                                                                                                                                                 10/14
  Installing : pytalloc-2.1.16-1.el7.x86_64                                                                                                                                             11/14
  Installing : samba-libs-4.10.16-9.el7_9.x86_64                                                                                                                                        12/14
  Installing : samba-common-tools-4.10.16-9.el7_9.x86_64                                                                                                                                13/14
  Installing : samba-4.10.16-9.el7_9.x86_64                                                                                                                                             14/14
  Verifying  : samba-libs-4.10.16-9.el7_9.x86_64                                                                                                                                         1/14
  Verifying  : samba-client-libs-4.10.16-9.el7_9.x86_64                                                                                                                                  2/14
  Verifying  : libldb-1.5.4-1.el7.x86_64                                                                                                                                                 3/14
  Verifying  : libtevent-0.9.39-1.el7.x86_64                                                                                                                                             4/14
  Verifying  : samba-common-tools-4.10.16-9.el7_9.x86_64                                                                                                                                 5/14
  Verifying  : samba-common-4.10.16-9.el7_9.noarch                                                                                                                                       6/14
  Verifying  : libwbclient-4.10.16-9.el7_9.x86_64                                                                                                                                        7/14
  Verifying  : libtalloc-2.1.16-1.el7.x86_64                                                                                                                                             8/14
  Verifying  : samba-4.10.16-9.el7_9.x86_64                                                                                                                                              9/14
  Verifying  : samba-common-libs-4.10.16-9.el7_9.x86_64                                                                                                                                 10/14
  Verifying  : pytalloc-2.1.16-1.el7.x86_64                                                                                                                                             11/14
  Verifying  : python-tdb-1.3.18-1.el7.x86_64                                                                                                                                           12/14
  Verifying  : pyldb-1.5.4-1.el7.x86_64                                                                                                                                                 13/14
  Verifying  : libtdb-1.3.18-1.el7.x86_64                                                                                                                                               14/14

  samba.x86_64 0:4.10.16-9.el7_9

Dependency Installed:
  libldb.x86_64 0:1.5.4-1.el7                     libtalloc.x86_64 0:2.1.16-1.el7            libtdb.x86_64 0:1.3.18-1.el7                    libtevent.x86_64 0:0.9.39-1.el7
  libwbclient.x86_64 0:4.10.16-9.el7_9            pyldb.x86_64 0:1.5.4-1.el7                 pytalloc.x86_64 0:2.1.16-1.el7                  python-tdb.x86_64 0:1.3.18-1.el7
  samba-client-libs.x86_64 0:4.10.16-9.el7_9      samba-common.noarch 0:4.10.16-9.el7_9      samba-common-libs.x86_64 0:4.10.16-9.el7_9      samba-common-tools.x86_64 0:4.10.16-9.el7_9
  samba-libs.x86_64 0:4.10.16-9.el7_9

[root@test-machine01 yum.repos.d]#

Configure smb service to ON after server reboot and start smb SERVICE.

[root@test-machine01 app_share]# chkconfig smb on
Note: Forwarding request to 'systemctl enable smb.service'.
Created symlink from /etc/systemd/system/multi-user.target.wants/smb.service to /usr/lib/systemd/system/smb.service.

[root@test-machine01 app_share]# service smb start
Redirecting to /bin/systemctl start smb.service

[root@test-machine01 app_share]# systemctl list-unit-files |grep smb
smb.service                                   enabled

Please note we are using file system /u01/app_share for sharing purposes. and application User is appuser, grant vital privileges to application User appuser on /u01/app_share.

[root@test-machine01 app_share]# chown -R appuser:appuser /u01/app_share
[root@test-machine01 app_share]# chmod 775 app_share

[root@test-machine01 u01]# pwd
[root@test-machine01 u01]# ls -ld app_share
drwxrwxr-x. 2 appuser appuser 54 Dec 23 12:43 app_share

[root@test-machine01 u01]#  chcon -Rt samba_share_t /u01/app_share

Take a backup of smb config file earlier than editing it. Add/modify the below parameters in a samba config file. Please observe dailyreport keyword will be used for accessing the share drive, So you can add your share name as consistent with your requirement. Test if all parameter is valid using testparm command. Once all changes are done restart smb service.

[root@test-machine01 samba]# pwd

[root@test-machine01 samba]# cp smb.conf smb.conf.backup
[root@test-machine01 samba]# vi smb.conf

        workgroup = <Add your company workgroup name>
        netbios name = test-machine01 
        map to guest = bad user
        max protocol = SMB2

 	path = /u01/app_share
 	browseable = yes
	guest ok = yes
	guest only = yes
 	read only = no
 	force user = appuser
 	force group = appuser
	force create mode = 0777
	force directory mode = 0777

[root@test-machine01 samba]# testparm
Load smb config files from /etc/samba/smb.conf
Loaded services file OK.

[root@test-machine01 samba]# service smb restart
Redirecting to /bin/systemctl restart smb.service

Now you can access \\192.168.xxx.xxx\dailyreport from Windows Server and you can use this shared drive to store modify or delete files.

Just to validate, the same files exist in Linux Server under file system /u01/app_share.

[root@test-machine01 app_share]# ls -ltr
total 1892
-rwxrwxrwx. 1 appuser appuser 1907863 Jan 13 2016 SQL Example.pdf
-rwxrwxrwx. 1 appuser appuser 12115 Jun 7 2020 Jamsher_Test.xlsx
-rwxrwxrwx. 1 appuser appuser 47 Dec 23 11:32 Test File.txt

This document is just for learning purpose and always validate in the LAB environment first before applying in the LIVE environment.

Hope so you like this article
Please share your valuable feedback/comments/subscribe and follow us below and don’t forget to click on the bell icon to get the most recent update. Click here to understand more about our pursuit.



How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Jamsher Khan

Hello and welcome to DBsGuru,I’m Jamsher Khan working as Senior Oracle DBA based in KSA-Jeddah, I have working experience in Oracle DBA, SQL Server, MySql, PostgreSQL, Linux, Golden Gate, ODA.Thanks for the visits!Share Learn Grow!