| Samba Server | |
| Known as Windows file sharing, the Samba server (and client) in Fedora Core 32 is part of the "Windows File Server" package group. It also is available as two stand-alone packages called samba, and samba-client. (Samba client is covered further below.) | |
|
| 1) To install: [root@localhost ~]# dnf groupinstall "Windows File Server" --allowerasing The "yum" command could also be used in place of "dnf". In either case, the option "--allowerasing" lets old packages be removed in order to resolve dependencies. An alternative is to install only the server. This might be used in a case where there is no need to browse samba shares from the server: dnf install samba cifs-utils --allowerasing | |
| 2) Once installed, make a directory to share, and edit the configuration file: [root@localhost ~]# mkdir /home/testshare [root@localhost ~]# vi /etc/samba/smb.conf ("vim" could also be used to edit if it's installed. It's my preference. "vim" is found in the "vim-enhanced" and "vim-X11" packages). | |
|
3) Add the following lines into your file. Change "PRACTICE" into your actual workgroup name, SERVER1 into your server name, 192.168.1. into your actual IP address prefix, and user1 / group1 into any legitimate users and/or groups you're allowing. Variables are preceeded by a % (percent) sign. Comments are preceeded by a # (number / hashtag) sign.
[global]
unix charset = UTF-8
netbios name = SERVER1
workgrouop = PRACTICE
hosts allow = 192.168.1. 127.
server string = Samba Server 1 %v
security = user
passdb backend = tdbsam
[TestShare]
comment = TestShare
path = /home/testshare
valid users = user1 @group1
public = no
writeable = yes
write list = user1
create mode = 0775
Save the file, and exit.
| |
| 4) Test and verify the syntax of the configuration file: [root@localhost ~]# testparm | |
| 5) If the firewall is running (firewalld), and it probably is, the samba protocol needs to be allowed to pass through: [root@localhost ~]# systemctl status firewalld [root@localhost ~]# firewall-cmd --permanent --add-service=samba [root@localhost ~]# firewall-cmd --reload [root@localhost ~]# firewall-cmd --list-services | |
| 6) The next important step is to make sure SELinux (if it's running -- which it likely is) will allow users functional access to files via samba: [root@localhost ~]# setsebool -P samba_enable_home_dirs on In some instances, these following two may be necessary. Use with great care as "_ro" lets samba read all files on a system, and "_rw" lets samba share all files on a system: [root@localhost ~]# setsebool -P samba_export_all_ro on [root@localhost ~]# setsebool -P samba_export_all_rw on Then refresh the connection to the share: [root@localhost ~]# restorecon -R /home/testshare | |
| 7) Before we're finished, we must also create samba users. These are basically extensions of accounts for system users. If you haven't already done so, you would add a user to the system first, and then add the user to samba: [root@localhost ~]# useradd user1 [root@localhost ~]# passwd user1 [root@localhost ~]# pdbedit -a user1 | |
| 8) Finally, enable the service allowing it to both restart now and on re-boot: [root@localhost ~]# systemctl enable --now smb The process should be complete, and your samba server should be successfully running! | |
| Samba Client | |
| As with the server in Fedora Core 32, the client is available as a package called samba-client, and the first step is installation if it weren't already installed above. | |
| 1) To install: [root@localhost ~]# dnf install samba-client --allowerasing Again, the "yum" command could also be used in place of "dnf". In either case, the option "--allowerasing" lets old packages be removed in order to resolve dependencies. | |
| 2) Samba also uses client access ports, and the firewall may be blocking browsing through them so be sure to allow access for them as well: [root@localhost ~]# firewall-cmd --permanent --add-port=137-138/udp [root@localhost ~]# firewall-cmd --reload | |
| To browse available shares for a user, enter the following command: [root@localhost ~]# smbclient -L SERVER1 -U user1 And that should have you covered. Enjoy! | |
| | |