Networking: Sharing folders between Windows and Linux using Samba
There are plenty of ways to share resources and files between two or more computers. You could do things like:
- Email yourself an attachment.
- Use FTP between the two PC's.
- Use SSH between the two computers.
- Use sneaker-net: copy the files to Flash Disk, DVD, CD, (gulp) floppy etc. and walk over to the other computer then load them up.
- Copy the file by hand.
- etc (It pretty much just goes downhill from here).
Or you could enable NFS or better yet, as we will discuss here, use SAMBA and share entire folders, allowing you to simply save to a shared folder making the file / folder visible from other PC's on your network.
We will therefore do two things over the network in this post using SAMBA:
- Mount Windows shared folders on Linux.
- Map Linux shared folders (Using Map Network Drive… option) on Windows.
This of course will be different then simply mounting partitions on the same machine as we have outlined in Windows / Linux: Mutually accessing various filesystems on the same PC. since will be doing this type of sharing over the network instead of just on the same PC. In this post we will share folders between Fedora Linux and Windows, though the general config of the applications can apply to other distributions. Overall, having said the above, here's how the setup can look like for you as well:
Here's how to get this done:
LINUX : Mounting Shared Windows folders on Linux
Here are the steps in order to get SMB / SAMBA configured on the Linux host to see a windows shared path:
STEP | DESCRIPTION | COMMAND |
1 | Check if you have the necessary packages, commands and daemons running. (If you get command not found or No such file or directory, you'll need to install these prior to going further with the installation.) |
Run the below to check if chkconfig and the SAMBA RPM's are installed:
# which chkconfig
# rpm -aq|egrep -i "smb|samba" If anyone is missing, you can use: # nice -n 19 yum search samba to get a list of available packages to install from. Check if the smb daemon is installed:
# chkconfig –list smb If nothing comes back other then the prompt, check if the service exists:
# ls -al /etc/init.d/smb and enable it in this manner: # chkconfig –add smb 5 to add it to run level 5 (Linux GUI stage). Then turn it on in this manner: # chkconfig –level 5 smb on Samba comes with an comprehensive set of commands to choose from. Those most important to this post are enbolded:
/usr/bin/findsmb To find out version of package owning above files use:
# rpm -qf /usr/bin/smbclient Finally, you can use:
# ps -ef |grep smbd to ensure it is in fact running. If the daemon is not running you can restart it by running: # service smb restart OR # /etc/init.d/smb restart
|
2 | Share a folder on the Windows PC so it is visible. Before you can access the remote folders through Linux, they need to be shared first on the remote Windows PC. |
Ensure:
You will notice that after you do this there will now be a blue hand under that folder indicating it is shared:
as opposed to:
for non shared folders. |
3 | On Linux, verify that the remote Windows machine shares are visible. |
For this, we wil use the smbclient command like this:
# smbclient -L 192.168.57.7
Sharename Type Comment
Server Comment
Workgroup Master At least one shared folder off the remote Windows PC should be visible. In this case, HomeVideos is visible, which is good.
|
4 | Mount the remote Windows shared drives and access them as if any UNIX folder. |
Create a mount folder then use the mount command to mount the shared drive:
# mkdir /mnt/HomeVideos though even depending on permissions and setup, the default anonymous user should work (see further down): # mount -t cifs "//192.168.76.6/HomeVideos" "/mnt/HomeVideos" Test the drive by navigating to it and creating a test file:
# cd /mnt/HomeVideos On your Windows system, check that the test-file.txt exists and remote it. This simulates a short read and write test on both systems.
|
5 | Help! I've encountered problems! |
See the Q&A below. If you don't find the answer there, try to search this post as many errors I've encountered are listed in the Q&A.
|
Click below for next page…
Warning: Declaration of Social_Walker_Comment::start_lvl(&$output, $depth, $args) should be compatible with Walker_Comment::start_lvl(&$output, $depth = 0, $args = Array) in /homepages/16/d94766727/htdocs/wp/wp-content/plugins/social/lib/social/walker/comment.php on line 18
Warning: Declaration of Social_Walker_Comment::end_lvl(&$output, $depth, $args) should be compatible with Walker_Comment::end_lvl(&$output, $depth = 0, $args = Array) in /homepages/16/d94766727/htdocs/wp/wp-content/plugins/social/lib/social/walker/comment.php on line 42
[…] Tom Kacperski wrote an interesting post today onNetworking: Sharing folders between Windows and Linux using SambaHere’s a quick excerpt […]
[…] Networking: Sharing folders between Windows and Linux using Samba […]
[…] Networking: Sharing folders between Windows and Linux using Samba […]
[…] NT_STATUS_UNSUCCESSFUL Setting up rules in the firewall between server/client for ports 445,139 etc might do it for your […]
[…] it's all said and done then shared with the rest of the network , including a new Nexus 7 running Android through AndSMB, and tweaked for quick data transfers it […]
[…] Networking: Sharing folders between Windows and Linux using Samba Fedora Update: undefined symbol: DRIOpenDRMMaster […]
[…] Windows and Linux: Samba / CIFS Network Sharing […]
[…] follow us on our Samba / CIFS Connectivity page for the resolution to the issue. Hope this helps […]
[…] tips on this Samba / CIFS Connectivity page may […]
[…] Windows and Linux: Samba / CIFS Network Sharing […]
[…] can also enable SMB / Samba file sharing on the individual cluster hosts and allow visibility to the Gluster FS / NFS – Ganesha […]