Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- command -v mount.cifs >/dev/null 2>&1 || {
- echo "I require mount.cifs but it's not installed. You can install via apt:" >&2;
- echo " sudo apt-get install cifs-utils"
- echo ""
- echo "Press any key to abort."
- read
- exit 1;
- }
- myPath=$HOME/tmp/$(uuidgen)
- mkdir -p $myPath
- echo 'Defaults:'
- echo ' IP : 192.168.1.X (You must enter X)'
- echo ' windows username : fakeuser'
- echo ' windows password : fakepassword'
- echo ''
- read -p 'Use Default Value? [Yes]/no:' defaults
- if [ "$defaults" = "" ]
- then
- read -p 'IP : 192.168.1.' winIP
- winIP="192.168.1."$winIP
- read -p 'windows shared folder : ' winDir
- winUser=fakeuser
- winPass=fakepassword
- else
- read -p 'IP : ' winIP
- read -p 'windows shared folder : ' winDir
- read -p 'username : ' winUser
- if [ "$winUser" = "" ]
- then
- winUser=fakeuser
- fi
- read -sp 'password : ' winPass
- if [ "$winPass" = "" ]
- then
- winPass=fakepassword
- fi
- fi
- echo " "
- sudo mount -t cifs "//"$winIP"/"$winDir $myPath -o dir_mode=0777,file_mode=0777,username=$winUser,password=$winPass
- xdg-open $myPath
- echo ""
- read -p "Done with sharing? Ready to unmount folder?"
- sudo umount "//"$winIP"/"$winDir
- rmdir $myPath
Add Comment
Please, Sign In to add comment