52 lines
1.3 KiB
Bash
52 lines
1.3 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
while true
|
|
do
|
|
read -p "Where would you like to mount your share?: " MOUNT_DIR
|
|
|
|
if [ -d "$MOUNT_DIR" ]; then
|
|
echo "The Directory $MOUNT_DIR Already Exist"
|
|
sleep 1
|
|
else
|
|
mkdir -p $MOUNT_DIR
|
|
echo "creating $MOUNT_DIR"
|
|
break
|
|
fi
|
|
done
|
|
while true
|
|
do
|
|
read -p "What is your Shares Username?: " SMB_USR
|
|
|
|
if [ -d "$SMB_USR" ]; then
|
|
echo "username=$SMB_USR" >> /.smb-credentials
|
|
sleep 1
|
|
else
|
|
echo "username=$SMB_USR" >> /.smb-credentials
|
|
break
|
|
fi
|
|
done
|
|
while true
|
|
do
|
|
read -p "What is your Shares Password?: " SMB_PASS
|
|
|
|
if [ -d "$SMB_PASS" ]; then
|
|
echo "password=$SMB_PASS" >> /.smb-credentials
|
|
sleep 1
|
|
else
|
|
echo "password=$SMB_PASS" >> /.smb-credentials
|
|
break
|
|
fi
|
|
done
|
|
while true
|
|
do
|
|
read -p "What is your Shares IP Address?: " SMB_ADDR
|
|
read -p "Where is your Share located on the remote server? i.e /mnt/Share: " SMB_REMDIR
|
|
|
|
if [ -d "$SMB_ADDR" ]; then
|
|
sudo mount -t cifs -o rw,vers=3.0,credentials=/.smb-credentials //$SMB_ADDR/$SMB_REMDIR $MOUNT_DIR
|
|
sleep 1
|
|
else
|
|
sudo mount -t cifs -o rw,vers=3.0,credentials=/root/.smb-credentials //$SMB_ADDR/$SMB_REMDIR $MOUNT_DIR
|
|
break
|
|
fi
|
|
done |