Guest User

Untitled

a guest
Jul 12th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #/bin/bash
  2.  
  3. ##Script to mount cifs shares on linux
  4.  
  5. unset username
  6. unset password
  7. DIRECTORY="/mnt/Zdrive" #local mount point
  8.  
  9. ### Check if cifs package is installed
  10.  
  11. if [ -f "/etc/redhat-release" ]; then
  12. yum install cifs-utils -y >/dev/null
  13. else
  14. apt-get install cifs-utils -y >/dev/null
  15. fi
  16.  
  17. ##Check if mount point is there
  18.  
  19. if [ -d "$DIRECTORY" ]; then
  20. : echo "$DIRECTORY present "
  21.  
  22. else
  23. mkdir "$DIRECTORY"
  24. fi
  25.  
  26. ## Get Credentials
  27.  
  28. echo ""
  29. read -p "Enter Username(Windows):" username
  30. read -s -p "Enter Password: " password
  31.  
  32. #Mount
  33. echo ""
  34. mount -t cifs -o vers=1.0,username=$username,password=$password,domain=example //example.com/Zdrive /mnt/Zdrive
  35. echo ""
Add Comment
Please, Sign In to add comment