Advertisement
Guest User

Untitled

a guest
Feb 15th, 2013
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.86 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #mount.cifs //alexis-pc/users /mnt/alexis-pc/users/ -o user=alexis-pc/user,pass='*@p1te)',rw,ip=10.0.0.123
  4.  
  5. # Arguments:
  6. # <computername> <share> <username>
  7. # pass='*@p1te('
  8. # mount.cifs //$1/$2 /mnt/$1/$2/ -o user=$1/$3,rw,ip=10.0.0.123
  9.  
  10. dirname=`echo $2 | sed "s/\\$//g"`
  11.  
  12. echo "Ensuring mountpoint exists... ($dirname)"
  13. if [ ! -d /mnt/$1/$dirname] ]; then
  14.   if [ ! -d /mnt/$1] ]; then
  15.     mkdir /mnt/$1
  16.   fi
  17.  
  18.   if [ ! -d /mnt/$1/$dirname] ]; then
  19.     mkdir /mnt/$1/$dirname
  20.   fi
  21. fi
  22.  
  23. echo Looking up NetBIOS name to IP translation...
  24. ipaddr=`nmblookup $1 | egrep "([0-9.]+) $1" -o | egrep "^[0-9.]+" -o`
  25.  
  26. echo Mounting //$1/$2 at /mnt/$1/$dirname using user $1/$3 at IP $ipaddr ...
  27. mount.cifs --verbose //$1/$2 /mnt/$1/$dirname/ -o user=$1/$3,rw,ip=$ipaddr,uid=0,gid=1001,file_mode=0760,dir_mode=0770,forceuid,forcegid,iocharset=utf8
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement