Some notes on setting up and auto mounting a Windows Share on an Ubuntu host.
I’ve had to Google the details for this more than once, so thought I’d write up the steps here for next time…
First, if it’s not there already, add the Windows IP address and HostName to the Ubuntu /etc/hosts file:
vim /etc/hosts, then add something like:
192.168.0.123 MyWindowsHostName
Now install the smbfs packages if you don’t already have them:
sudo apt-get install smbfs
sudo apt-get install smbclient
Once that’s complete, and assuming the windows shares are set up ok (and there are no firewall issues, and you can ping the host etc), check that we can view the host and its shares with smbclient:
root@linux:/mnt# smbclient -L MyWindowsHostName
Enter root’s password:
Domain=[LIMBO] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
Sharename Type Comment
——— —- ——-
Video Disk
IPC$ IPC Remote IPC
Music Disk
Domain=[LIMBO] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
If that gives you back something that looks like your Windows hosts and its share(s), things are looking good 🙂
Further information on using smbclient can be found here if you have any problems.
Now it’s time to make a local mount point, so as root or via sudo;
mkdir /mnt/Video
Then as root create a password file /etc/cifspw with the login credentials for your Windows account.
username=WINDOWSUSERNAME
password=WINDOWSPASSWORD
it would be good practice to secure that file so that only the owner (root) has read/write access to it:
$ sudo chmod 600 /etc/cifspw
Then vim /etc/fstab and add a line for the mount:
//MyWindowsHostName/Video /mnt/Video cifs exec,credentials=/etc/cifspw 0 0
If all goes well, the Windows share should now automatially mount to /mnt/Video at boot time.
If you can’t wait to test it, you can do:
sudo mount -a
and check /mnt/Video to see your data… hopefully!
Cheers,
Don
Discover more from Don's Blog
Subscribe to get the latest posts sent to your email.