Skip to content

Instantly share code, notes, and snippets.

@bilalhusain
Created March 9, 2012 07:51
Show Gist options
  • Save bilalhusain/2005565 to your computer and use it in GitHub Desktop.
Save bilalhusain/2005565 to your computer and use it in GitHub Desktop.
mount network drive on linux
#!/bin/bash
USER=bilal
DOMAIN=localnetwork.com
LOCAL_LOCATION=/home/bilal/networkStorage
REMOTE_LOCATION=//{IP_ADDRESS}/{DIRECTORY}
sudo mount -t smbfs -o username=$USER,domain=$DOMAIN $REMOTE_LOCATION $LOCAL_LOCATION
echo -e "to unmount:\n\tsudo umount $LOCAL_LOCATION"
# troubleshooting:
# ensure smbfs installed (sudo apt-get install smbfs)
# $MACHINE_NAME = `hostname -s`
# ensure /etc/hosts contains
# 127.0.1.1 $MACHINE_NAME.$DOMAIN
# ensure /etc/hostname contains
# $MACHINE_NAME.$DOMAIN
# tip: change password
# smbpasswd -r $DOMAIN -U $USER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment