firwalld=$(command -v firewalld 2>/dev/null)
ufw=$(command -v ufw 2>/dev/null)
if [ $firewalld > /dev/null 2>&1 ]; then 
  echo 'Use firewalld' 
    firewall-cmd --zone=public --add-service samba
    firewall-cmd --zone=public --permanent --add-service samba 
elif [ $ufw > /dev/null 2>&1 ]; then 
  echo 'Use ufw' 
    ufw allow Samba
else
  echo -e "\n${COLOR_RED}We do not know what firewall you use !!!${COLOR_REST}\n"
fi
Last modification:May 8, 2018
If you think my article is useful to you, please feel free to appreciate