Skip to content

How to mount Windows shares on Debian

June 30, 2012

1. First than all, we have to install samba file system:
sudo apt-get install smbfs

2. At the users home directory create a file with the domain credentials:
cd /home/username
echo username=domainuser> .smbpasswdecho password=domainpassword» .smbpasswdchmod 600 .smbpasswd

3. Create the directories for the shared directories:
cd /mntmkdir directoy1

4. Check the uid and the gid from the linux user:
sudo cat /etc/passwd |grep username

That line will return us something like:
username:x:1000:1000:User Names „,:/home/username:/bin/bash

In these case the uid and the gid code is 1000.

5. Edit the fstab file and add the commands to mount the shares
sudo nano /etc/fstab

Inside the file we have to add a line by every shared directory that we want to mount:
//xxx.xxx.xxx.xxx/shareddirectory /mnt/directory1 smbfs credentials=/home/username/.smbcredentials,uid=1000,gid=1000 0 0

6. Finally we check the configuration and we mount the shares:
mount -a

No comments yet

Leave a comment