Mount Windows Share in Linux
On Ubuntu, install cifs-utils
1 |
apt-get install cifs-utils |
First create a directory on which we can mount the windows share
1 |
mkdir /media/SHARE_NAME |
Now create a file to store windows share username and password.
1 |
vi /etc/SHARE_NAME.smbcredentials |
Add following to the file
1 2 |
username=YOUR_WINDOWS_SHARE_USER password=YOUR_WINDOWS_SHARE_PASSWORD |
Now run
1 |
mount -t cifs //192.168.0.4/SHARE_NAME /media/SHARE_NAME -o credentials=/etc/SHARE_NAME.smbcredentials,uid=LINUX_USER_NAME,iocharset=utf8,sec=ntlm,rw,dir_mode=0777,file_mode=0666 |
192.168.0.4 – Replace with IP of your Windows computer with share.
LINUX_USER_NAME – Replace with the Linux user name you want the files to be owned.
To make share mounted on boot, edit
1 |
vi /etc/fstab |
Add
1 |
//192.168.0.4/SHARE_NAME /media/SHARE_NAME cifs credentials=/etc/SHARE_NAME.smbcredentials,uid=LINUX_USER_NAME,gid=GID_OF_LINUX_USER,_netdev,iocharset=utf8,dir_mode=0777,file_mode=0666 0 0 |