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:
Here are the steps in order to get SMB / SAMBA configured on the Linux host to see a windows shared path:
|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:
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
# /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.||
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
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!||
Click below for next page…