Samba mount using smbmount

Below you can find a script which mounts  a share over a network to a local folder using ‘smbmount’. I prefer using ‘smbmount‘ instead of ‘mount‘ as unmounting shares executes without any pain.

The script below first asks for a password while blocking console output. You can safely put in your password without appearing it into your bash history.


echo ""
echo "Provide the share password:"
# Hide the console output and read the input
stty_orig=`stty -g`
stty -echo
read adminpassword
stty $stty_orig
# Connect to the share on the remote server using the password
echo "Connecting to remote share"
smbmount /// /home/wouter/folder/ -o username=,password=$adminpassword,uid=1000,mask=000
# Show an overview of all mounted devices / shares
echo "----------"
echo "----------"
echo "Done."


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.