If you use a Linux VPS, sometimes you would want to make a folder in it accessible from Windows. One of the best ways to do that is to use Samba. In this article, we are going to see how to do that. We assume here that you are logged into your Linux VPS, as user root
.
<p dir="auto"><br />
<a href="https://i.pinimg.com/originals/17/3a/15/173a154152b2f1864845ef8a505c0610.jpg" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Image source<span><img src="https://images.hive.blog/768x0/https://i.pinimg.com/originals/17/3a/15/173a154152b2f1864845ef8a505c0610.jpg" srcset="https://images.hive.blog/768x0/https://i.pinimg.com/originals/17/3a/15/173a154152b2f1864845ef8a505c0610.jpg 1x, https://images.hive.blog/1536x0/https://i.pinimg.com/originals/17/3a/15/173a154152b2f1864845ef8a505c0610.jpg 2x" />
<ul>
<li><p dir="auto">Make sure you allow access to ports 445 and 139 on your Linux VPS, as Samba uses those ports. So, adjust your Firewall settings accordingly.
<li><p dir="auto">Check if Samba is already installed and running on the Linux VPS by typing <code>service smbd status. If you get a not found message, it means Samba is not installed. So, install it by typing the following.
<pre><code> apt-get update
apt-get install samba
<ul>
<li><p dir="auto">Now add user <code>root and give a password to it for accessing shared folders, by typing <code>smbpasswd -a root.
<li><p dir="auto">Now create the folder you want to share if it doesn't already exist. Let us assume, you want to share the folder <code>/root/sharedfolder. In that case, you will first create it by typing <code>mkdir /root/sharedfolder.
<li><p dir="auto">Now using vi, open file <code>/etc/samba/smb.conf by typing <code>vi /etc/samba/smb.conf and add the following content at the end of it. You will need to press <code>i for inserting text. Here <code>thesharedfolder is the name by which you would access the folder <code>/root/sharedfolder from your Windows computer.
<pre><code> [thesharedfolder]
path = /root/sharedfolder
available = yes
valid users = root
read only = no
browsable = yes
public = yes
writable = yes
<ul>
<li><p dir="auto">Restart the Samba service by typing <code>service smbd restart.
<li><p dir="auto">Now you should be able to access this folder from your Windows computer. To do that, create a new shortcut and type <code>\\ip_address_of_the_node\thesharedfolder as location. <code>ip_address_of_the_node here is the IP address of the node where you created the shared folder. When Windows prompt your for credentials, select <code>More Choices and click on the option <code>Use a different account. There, type the username as <code>root and the password the one that you had set for the user <code>root for Samba.
Please give advice for betterment of each other.
✅ @hmushtaq Thank you for sharig this valuable information. sharing your thoughts and commenting can help. :) @sbanerjee0017 (Shyamal Banerjee[Age:62] Kolkata,INDIA)✍