You don’t have to waste your precious time using storage devices when you can move files quickly and easily over your local network (LAN). The main methods used to do this are:
Create a share in Linux to access it from Windows using Samba Create a share in Windows to access it from Linux
Create a share in Linux and access it from Windows using Samba
The best and fastest way to do this is by installing the Samba suite. Samba is an ideal solution for sharing files between different devices such as a Windows, Linux or Mac machines. The machines need to be networked with a generic router. Windows machines come with functionality that allows them to work with Samba out of the box, so you only need to install one package for Linux machines.
On your Linux machine open the location containing the files you wish to share.
Right-click on the file and select “Sharing Options.”
If you get a prompt asking you to install Samba services, click “Install service.”
Click Restart session once Samba service is installed to enable sharing.
Check the “Share this folder” and “Allow others to create and delete files in this folder” boxes.
Click “Create Share” to complete the process.
Open Terminal and type the following commands: Replace USERNAME with your own user name.
Find the global section and add the lines:
Press Ctrl + O and Ctrl + X to save and exit.
Restart Samba:
Go to the Windows machine and right-click Start, then select Run.
In the Run box, type the command: \computer_name\share_name5. Note: the computer name in this case can be the IP address of the Linux machine, which you can find by going to the Linux computer and opening terminal, then typing ipconfig.
Type the Linux computer name and share the resource name.
A prompt will be displayed asking for your credentials.
Type in your Linux username and password. Click OK.
Try to access the shares from your Windows computer. The new server should be displayed in “My Network Places” in Windows. Alternatively, do the following: right click Start and select Run, then enter: //server. Replace server with the name or IP address of the machine that runs your Samba server. A window with the browsable shares from the server will open. Note: to access non-browsable shares, use this code: \server\share name
Create a share in Windows to access it from Linux
This will be done in three steps as follows:
Enable sharing on Windows Share the folder Access it from Linux
Enable sharing on Windows
Start by ensuring the network settings are configured to allow a connection from the Linux system. To do this:
Go to Control Panel and click “Network and Internet.”
Select “Network and Sharing Center.”
The Network and Sharing Center window will open. Click “Change Advanced settings.”
Enable these two settings: “Network Discovery” and “Turn on file and printer sharing.”
Click Save changes.
Sharing is now enabled.
Share the folder
Create a shared folder for the Linux system to see, connect and access. You can share anything, so follow these steps:
Find the folder you want to share and right-click it.
Select “Properties.”
Under the Sharing tab, click “Advanced Sharing.”
Under the Advanced Sharing window, enable the “Share this folder” option.
Click “Permissions.” Note: in the Permissions window you can restrict access to the folder to specific users or accounts. Select “Full Control permission to Everyone” to give any user access. This way anyone can read and write changes to the files in the folder you share. If, however, you want to restrict access to specific user accounts, remove the “Everyone” user, add the users you want and then assign the relevant permissions to them. The user accounts are those that are on the Windows system (not the Linux system).
Click OK to close the Permissions window.
Click OK to close the Advanced Sharing window.
Go to the Security tab in the main properties window. Note: configure similar permissions as those in the sharing settings so that Linux users can access the shared folder. If they don’t match, the most restrictive settings are applied. However, if the user you intend to share with already has security permissions, close the window and move to the third step. Otherwise, click “Edit” to add a user, click “Add” in the Permissions window that opens, and enter the user’s details.
Click OK on all windows. The folder should now be shared with your network.
Access from Linux
You can mount the shared folder using Linux GUI or by using a command line. For our example we’ll use Terminal because it works across many distributions, and it’s faster. To do this, you’ll need the cifs-utils package to mount SMB shares. The complete the following steps.
- In the terminal, type:
- Make a directory.
- Mount the share to the directory
- Create a folder on the desktop. (It’s easier to access from here.)
- Create and mount the folder using these commands: Note: if prompted for the root password of the Linux system and for your user account on Windows, insert each of them and run the command. You’ll now see the contents of the Windows share and will be able to add data to it. Are you now able to transfer files to and from Linux and Windows systems? Tell us what worked for you, and if you have a different method, share with us below.