How to auto-mount Windows share drives in Linux

6 views
Skip to first unread message

Michael Hughes

unread,
Oct 28, 2008, 12:48:23 AM10/28/08
to UMUCLUG
1.) Create mountpoints in /mnt:
sudo mkdir /mnt/SHARE /mnt/HOME
(this is just an example. What you create depends on what share
drives you want access to)

2.) Create your credentials file (will contain your AD credentials -
yes, this is a security risk!):
sudo vi /etc/samba/creds-file
username=yourADusername
password=************

3.) Change permissions on creds file to Root-readable only:
sudo chmod 600 /etc/samba/creds-file

4.) Add the following lines to your fstab file (back it up first!, and
replace "yourADusername" with your Active Directory username, and
replace "username" w/your Linux username (type "whoami" at the command
prompt) and replace "groupname" with your group (usually the first
item in the list returned when you type "groups" at the command line):

sudo cp /etc/fstab /etc/fstab.bak
sudo vi /etc/fstab

//fileserver.domain.com/pathToSHAREfolder$/ /mnt/SHARE
smbfs credentials=/etc/samba/creds-
file,uid=username,gid=groupname 0 0
//fileserver.domain.com/pathToHOMEfolder$/yourADusername /mnt/
HOME smbfs credentials=/etc/samba/creds-
file,uid=username,gid=groupname 0 0

5.) Refresh fstab:
sudo mount -a

6.) Create desktop links:
ln -s /mnt/SHARE/pathToYourSHAREfolder/ ~/Desktop/Share_drive
ln -s /mnt/HOME/ ~/Desktop/Home_drive
Reply all
Reply to author
Forward
0 new messages