diff options
author | Ibrahim Mkusa <ibrahimmkusa@gmail.com> | 2024-08-10 11:35:54 -0400 |
---|---|---|
committer | Ibrahim Mkusa <ibrahimmkusa@gmail.com> | 2024-08-10 11:35:54 -0400 |
commit | de37038d1507a4906e260e5a2f2e47f85bf3b71d (patch) | |
tree | 2176fe46708365e20ab08c22e6794348234fae47 /samba | |
parent | d1e18d0a52ca76e27ada8638b8d4b73dd225dc71 (diff) |
handles samba on both fedora and debian families
Diffstat (limited to 'samba')
-rw-r--r-- | samba/setup.sh | 27 |
1 files 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 <<EOF |