• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

CentOS / RHEL 7 : How to open the Firewall port for Samba server using FirewallD

by admin

Question : I cannot reach my Samba server after starting the service. How do I open the port to be able to connect to my Samba server?

Solution :

If running FirewallD, it is mandatory to open the ports used by the Samba server in order for it to properly accept clients. To begin with check the firewalld status using the systemctl command :

# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2016-10-29 21:47:04 IST; 1 weeks 4 days ago
 Main PID: 1055 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─1055 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

Oct 29 21:46:50 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Oct 29 21:47:04 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.

As seen in the output above the firewall service is active and running. So we are good to go further.

Check the list of open ports and services using the commands below :

# firewall-cmd --list-ports
# firewall-cmd --list-services

Once you have confirmed that the samba ports are not open on the system, open the Samba port using the following FirewallD command:

# firewall-cmd --add-service=samba

The above command will change the runtime, opening the port temporarily. Make the changes permanent using the following command (this will persist through reboot):

# firewall-cmd --add-service=samba --permanent

Verify

To verify if the samba service is added to the firewalld use :

# firewall-cmd --list-services
dhcpv6-client samba ssh

As you can see samba service is now added to the firewall and samba ports are now open.

Filed Under: CentOS/RHEL 7

Some more articles you might also be interested in …

  1. “yum update” fails with “[package version 1] is a duplicate with [package version 2]”
  2. How to Enable Remote Desktop to Share the Current Desktop Session in CentOS/RHEL 7
  3. RHEL 7 – RHCSA Notes : Configure a system to use time services
  4. CentOS / RHE 7 : How to Prevent Users from Using the Last 10 Passwords
  5. Understanding multipath Utility to Configure DM-Multipath
  6. How to set ulimit values for a systemd service
  7. How to Manage Virtual Machines from the CentOS/RHEL 8 Web Console-Cockpit
  8. CentOS / RHEL 7 : Lock User Account After N Number of Incorrect Login Attempts
  9. How to configure multicast on an IP address (interface)
  10. How to disable IPv6 on CentOS / RHEL 7

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright