Client Samba pour Debian 9

un script pour ajouter un partage samba sur un poste linux.

#!/bin/bash
# Source: https://linuxconfig.org/how-to-configure-samba-server-share-on-debian-9-stretch-linux

echo "Auteur : Tommy Gingras"
echo "Date : 2017-07-18"
echo "But : Installer et configurer Samba client."
echo "Version : 1.0.0"

GREEN='\033[0;32m'
NC='\033[0m' # No Color

apt update
apt install smbclient cifs-utils

read -p "Enter the complete path to the resource (eg. //172.16.0.1/share)" path
read -p "Enter the mount point (eg. /mnt/share)" mountPoint

read -p "User ID (UID):" VUID
read -p "Group ID (GID):" VGID
read -p "Enter your username: " username
read -s -p "Enter your password: " password
echo 

mkdir -p $mountPoint

echo "username=$username" > /usr/local/hidden.cred
echo "password=$password" >> /usr/local/hidden.cred
echo "domain=WORKGROUP" >> /usr/local/hidden.cred

chmod 0600 /usr/local/hidden.cred

echo -e "$path\t$mountPoint\tcifs\tcredentials=/usr/local/hidden.cred,uid=$VUID,gid=$VGID\t0\t0" >> /etc/fstab

mount -a

echo -e "${GREEN}Installé et configuré. ${NC}"

 

Laisser un commentaire