How to mount SMB/CIFS/Windows shares under Linux.

Just type:
apt-get install smbfs
then use the mount command to mount remote windows partition or windows share under Linux as follows:

mount -t cifs // -o username=julia,password=julia /mnt/Julia

or with all rwx permissions:

mount -t cifs // -o iocharset=utf8,file_mode=0777,dir_mode=0777,username=julia,password=julia /mnt/Julia

also you can add it to /etc/fstab (make it “automatic”)

// /mnt/Julia smbfs auto,username=julia,password=julia,uid=1000,umask=000,user 0 0

but the better way is keep your username & password in a file only readable by root

// /mnt/Julia cifs credentials=/root/.mnt_Julia,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0

what should be in .mnt_Julia and how to make it:

touch /root/.mnt_Julia
echo "username=julia" >> /root/.mnt_Julia
echo "password=julia" >> /root/.mnt_Julia

Leave a Reply

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