DEV Community

Msaghu
Msaghu

Posted on • Updated on

HOW TO SET UP A LOCAL NETWORK BETWEEN YOUR LINUX VM(KALI) AND MY LOCAL WINDOWS USING SAMBA

Very excited to post my knowledge on this here as I had ran into this problem a few times while trying to access my local files in Windows into Linux(both in my Ubuntu and Kali Linux machines). The beauty of learning is that you learn new things that have already been solved. So let's get into it:

The Samba software package can also be used to communicate Linux servers and clients with Windows and MAC clients using Microsoft SMB.

PS: This breakdown assumes that you already have a Linux machine or have it set up as a Virtual Machine and are currently in the terminal

1. Update your system

sudo apt update

2. Install Samba on your system

sudo apt install samba

(press ctrl+z to opt out)

3. Check the status of Samba

sudo systemctl status smbd

4. Create the shared directory

sudo mkdir /home/mytutorialdirectory

5. Create full permissions for the directory

sudo chmod 777 /home/mytutorialdirectory

6. Add the directory

sudo useradd mytutorialdirectory

7. Setup a password for Samba (set up something that you can easily remember here)

sudo smbpasswd -a mytutorialdirectory

8. Setup smb.conf

sudo nano /etc/samba/smb.conf

or if you prefer vim as a text editor

sudo vi /etc/samba/smb.conf

scroll to the bottom and add
[mytutorialdirectory]
(2 spaces)path = /home/mytutorialdirectory
(2 spaces)browseable = yes
(2 spaces)valid users = mytutorialdirectory
(2 spaces)read list = mytutorialdirectory
(2 spaces)write list = mytutorialdirectory
(2 spaces)guest ok = no

(press ctrl+x then y ,then enter to opt out and save)

*9. Shows the changes that you made in the smb.conf file *

sudo testparm

10. Restart the Samba service and view status

sudo systemctl restart smbd

sudo systemctl status smbd

11. Access the Linux directory on Windows

Go back to your Windows local machine , press the windows icon key+R
Enter your Linux machine's IP address(you can find this by entering IP address in your Linux terminal and copying the inet IP address) and press enter

SUCCESS
You can now see your shared file

Top comments (0)