Creating a share on Linux and accessing via Windows

There are many times when there is data on a Linux system that needs to be moved to another system like Windows. Well, the question is how do you do that? The method that I have found to be the easiest is to use Samba. Below are the steps to achieve the overall intent.

1) Install Samba. The below syntax is for Debian based systems. For RPM, do “yum install samba”

sudo apt-get install samba

2) Configure a username and password that will be used to access the share. In this case, the user I will use is john as he is already a user on my system.

smbpasswd -a john

3) Create the directory that you’d like to share out to your Windows computer. We’re just going to put a folder on our Desktop.

mkdir ~/Desktop/test-share

4) Open the smb.conf file for editing

sudo vi /etc/samba/smb.conf

5) Scroll down to the end of the file and add the below lines. Supply the username and folder name from the steps listed above.

path = /home/<user_name>/<folder_name>
available = yes
valid users = <user_name>
read only = no
browsable = yes
public = yes
writable = yes

6) Save the file and close your editor. Now, restart the SMB service for the changes to take effect. Also note for some distributions, you may have to use “samba” instead of “smbd”

sudo service smbd restart

7) Your shared folder should now be accessible from a Windows PC. To access the Linux Share from Windows, type in the network location of the shared folder, with this syntax:


8) Done!