How to share file between Ubuntu and Windows?
In a network where you have Windows and Linux Ubuntu operating system it is a bit difficult to share file between Ubuntu and Windows. The best way to share file between Ubuntu and Windows, you need to install and configure Samba as file server in Ubuntu Linux. The Samba server will simply let you share files with Windows and Linux Ubuntu.
1. Installing Samba in Ubuntu
Samba is a free software re-implementation of the SMB/CIFS networking protocol. Samba provides file and print services for various Windows clients and can integrate with a Windows Server domain, either as a Domain Controller (DC) or as a domain member. So in this article we are using in Per-to-Per network between Windows clients and Linux Ubuntu clients. If you don’t like reading then watch the video tutorials at the end of this post.
- To install Samba file server in Ubuntu Linux, run the terminal by pressing Ctrl+Alt+Tkeys to open Linux terminal command line interface.
- Now type the “sudo apt-get install Samba” in order to install Samba file server. Type the password to start the installation.
Remember; your Ubuntu machine must be connected to internet. Because this apt-get install command will install software from Ubuntu online software repository.
2. Share File Between Ubuntu and Windows
Let’s do how to share a file in Ubuntu through file explorer? Open the File and create a folder in Home directory. I have created Netdata folder and required to be share it.
- Right click the Netdata folder and click Local Network Share. Select Share this folder.
To allow modification to files and folder for users, select Allow others to create and delete files in this folder. Also select Guest access (for people without a user account) to access files from Windows without requiring user and password.
2. Click Add the Permissions automatically to apply the permission to shared folder.
If you want to set a password for shared folder, you shout set a user for Samba file server with “sudo smbpasswd -a Shais” command then type the password twice.
Now it ask you user and password when someone want to access the shared folders. The the file sharing from Ubuntu Linux has completed successfully. Let’s test it from Windows 10 client.
3. Access Shared folders from Windows 10
You can access the Linux shared folders from Windows 10 using Network section. To simply access the shared folders type the \\IP address\Shared folders.
- In Windows 10 type \\192.168.0.104\NetData and press enter to open the shared files of Linux Ubuntu.
2. When prompt for network credential, type the user name and password. If you did not set a password for Samba files server, it will not ask the network credentials.
3. It’s all the contents of shared folder. You can create and delete files or edit the files.
To access the shared files quickly, create a shortcut link to a shared folder in Windows 10.
Right click on the desktop and click New then click Shortcut.
Type the network address of shared folder in Type the location of the item: and click Next.
Type a name for shortcut related to the shared folders contents and click Finish to create the shortcut.
Here is the shortcut link to the NetData shared folder of Ubuntu Linux. Double click to open it from your desktop. You can create a network Map drive also. To create network map drive, read this article How to Create Map Network Drive In Windows 10 and Server?
Troubleshoot File Sharing
The above article and video are a simple file sharing between Windows 10 and Linux Ubuntu. I didn’t assign a user to Samba file server on Linux. Because of this a user onTechnig Youtube channel asked a good question about sharing files and user permissions.
Asked by Ramsin Eivaz: question if I want a user and password, I assume I have to check only “allow others to create…” and not the guest access. But when I enter the ubuntu user and password, it is not able to login!! would you have any suggestions thanks.
Answer: You need to create a user account and add the user to Sambasharegroup. Then when you access the folder from Windows clients, you should use the that user name and password for viewing the shared files and folders.
1. First try to create a user in Ubuntu with “useradd” command or other command that help you create a user.
“sudo useradd -M -N -g sambashare Ali”
The -M parameter will not create a home directory for this user and the -N will not create a group with the same user name. The -g parameter just specify the group name.
I have created user name “Ali” and add it to “sambashare” group.
2. Let’s set a password for the Samba user with “smbpasswd” command.
“sudo smbpasswd -a Ali”
[sudo] password for shais:
New SMB password:
Retype new SMB password:
3. Now from Windows 10, type this user name and password in order to access the contents of shared folder.
Finally, thanks for sharing the feedback, issues and problems. Your comments are really help us to make articles better.