From de37038d1507a4906e260e5a2f2e47f85bf3b71d Mon Sep 17 00:00:00 2001 From: Ibrahim Mkusa Date: Sat, 10 Aug 2024 11:35:54 -0400 Subject: handles samba on both fedora and debian families --- samba/setup.sh | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/samba/setup.sh b/samba/setup.sh index 0dce3ae..9ddae0f 100644 --- a/samba/setup.sh +++ b/samba/setup.sh @@ -1,10 +1,27 @@ #!/usr/bin/env bash # description: setup samba for logged in user and creat shared folder "shared" -# update package indexes -sudo apt update -y -# install samba -sudo apt install samba -y +if [[ -f /etc/os-release ]]; then + . /etc/os-release + + case "$ID_LIKE" in + debian) + sudo apt update -y && sudo apt install -y samba + + # allow external access through firewall + sudo ufw allow samba + + ;; + fedora) + sudo dnf install -y samba + + # make adjustments in firewall + sudo firewall-cmd --add-service=samba --permanent + sudo firewall-cmd --reload + ;; + esac + +fi # create a folder on local directory to share mkdir -p /home/$USER/shared && chmod 777 /home/$USER/shared @@ -31,8 +48,6 @@ sudo smbpasswd -a $USER sudo systemctl restart smbd sudo systemctl restart nmbd -# allow external access through firewall -sudo ufw allow samba cat <