Fedora 24: Install samba and share with Windows 10

This article will describe how to install samba and access to home directory and share directory from Windows 10.

IP address of samba server is 192.168.11.67.

 

1 Install samba

Install samba with yum.

$ sudo yum install -y samba
$ sudo systemctl enable smb nmb

2 Port

Open port with using ervice file of firewall-cmd.

$ sudo firewall-cmd --add-service=samba --permanent
$ sudo firewall-cmd --reload

3 SELinux

Enable access to home directory without samba_share_t label.

$ setsebool -P samba_enable_home_dirs on

This article will not use other boolean value but below boolean values should be checked.

 

smbd_anon_write Allow guest write
samba_export_all_ro Allow read without samba_share_t
samba_export_all_rw Allow read/write without samba_share_t

 

Please see redhat manual for more information.

4 pdbedit

Add user access to samba with pdbedit.

$ sudo pdbedit -a hiroom2
new password:
retype new password:

5 /etc/samba/smb.conf

This article show how to share home directory for each user and share directory with multiple user.

Please reboot smbd and nmbd after editing smb.conf.

$ sudo systemctl restart smb nmb

5.1 Share home directory for each user

The samba in Fedora 24 provides home directory for each user by default. A <username> added by pdbedit can access to /home/<username>.

5.2 Share directory with multiple user.

Share permission 0777 directory with multiple user adde by pdbedit.

$ diff -uprN /etc/samba/smb.conf{.org,}
--- /etc/samba/smb.conf.org     2016-06-26 14:23:06.746109220 +0900
+++ /etc/samba/smb.conf 2016-06-26 14:33:03.639283003 +0900
@@ -34,3 +34,10 @@
        write list = root
        create mask = 0664
        directory mask = 0775
+
+[share]
+   comment = Share directory
+   path = /var/lib/share
+   read only = no
+   guest only = no
+   guest ok = no

Change /var/lib/share's permission to 0777. Add samba_share_t label to /var/lib/share.

$ sudo mkdir /var/lib/share
$ sudo chmod 0777 /var/lib/share
$ sudo chcon -R -t samba_share_t /var/lib/share

6 Access to samba from Windows 10

Access to \\192.168.11.67\hiroom2 with explorer.

Input username and password as same as pdbedit.

0001_Authentication-to-pdbedit.png

Accessed to hiroom2's home directory.

0002_Connected-Home-Directory.png

6.1 Map network drive

If mapping network drive, windows 10 will connect to samba automatically when user login.

Move to PC directory in explorer, Select "Map Network drive".

0003_Network-Drive.png

This time, mapping to \\192.168.11.67\share.

0004_Network-Drive-Folder.png

Network drive is mapped to samba share directory.

0005_Network-Drive-Completed.png