Advertisement
Guest User

Untitled

a guest
Feb 5th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. # Configure OSX to auto-mount an SMB share on boot.
  3. # Adjust any of these variables as needed.
  4.  
  5. set -ex
  6. sudo -v
  7.  
  8. # Hostname or IP of the remote machine running the SMB share.
  9. VM_HOST="vm.local"
  10.  
  11. # Remote SMB user and password.
  12. SMB_USER="devadmin"
  13. SMB_PASS="devadmin"
  14. # The name of the SMB instance hosted by the remote SMB server. If no
  15. # configuration was provided to the Samba server, it will, by default, share
  16. # the user's home directory and name the instance after the user.
  17. SMB_DIR="devadmin"
  18. SMB_CONFIG="/etc/auto_smb"
  19.  
  20. # This will create the SMB mount at /mnt/vm/dcms.
  21. LOCAL_MOUNT_ROOT="/mnt/vm"
  22. LOCAL_MOUNT="dcms"
  23.  
  24.  
  25. # Configuration for the /mnt/vm directory.
  26. sudo sh -c "echo '$LOCAL_MOUNT_ROOT auto_smb -nosuid' >> /etc/auto_master"
  27.  
  28. # Configuration for the SMB shared directory.
  29. [ -f $SMB_CONFIG ] || touch $SMB_CONFIG
  30. sudo sh -c "echo '$LOCAL_MOUNT -fstype=smbfs,soft,nosuid ://$SMB_USER:$SMB_PASS@$VM_HOST/$SMB_DIR' >> $SMB_CONFIG"
  31. sudo chmod 600 $SMB_CONFIG
  32.  
  33. # Mount shared directories
  34. sudo automount -vc
  35.  
  36. echo "SMB sharing has been configured. Folder accessible at $LOCAL_MOUNT_ROOT/$LOCAL_MOUNT"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement