0% found this document useful (0 votes)
0 views6 pages

OS File Sharing

To create a shared folder between a Linux and a Windows computer, install and configure Samba on the Linux machine, ensuring the shared folder has the correct permissions. Access the shared folder from Windows by entering the Linux machine's IP address in the File Explorer. Additionally, you can connect to the shared folder from an Android device using a file manager that supports SMB, and the shared folder will remain accessible after rebooting the Linux device if Samba is set to start at boot.

Uploaded by

Muhammad Ashraf
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views6 pages

OS File Sharing

To create a shared folder between a Linux and a Windows computer, install and configure Samba on the Linux machine, ensuring the shared folder has the correct permissions. Access the shared folder from Windows by entering the Linux machine's IP address in the File Explorer. Additionally, you can connect to the shared folder from an Android device using a file manager that supports SMB, and the shared folder will remain accessible after rebooting the Linux device if Samba is set to start at boot.

Uploaded by

Muhammad Ashraf
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Linux Windows File Sharing

i want to create a shared folder between two computers on the same network to transfer files
between each other, one computer is linux and the other is windows

To create a shared folder between a Linux and a Windows computer on the same network, you can use
Samba, a software that allows file sharing between Linux and Windows. Here's a step-by-step guide:

Step 1: Set up Samba on the Linux machine

1.1 Install Samba

On the Linux machine, install Samba if it's not already installed. Open a terminal and run:

bash

sudo apt update


sudo apt install samba

1.2 Configure Samba

Edit the Samba configuration file:

bash

sudo nano /etc/samba/[Link]

Scroll to the bottom and add the following lines to create a shared folder:

bash

[shared]
path = /home/username/shared
browseable = yes
read only = no
guest ok = yes
create mask = 0755

path: The directory you want to share (replace `/home/username/shared` with your desired folder).
browseable: Allows the shared folder to be visible in the network.
read only: Set to `no` so users can write to the folder.
guest ok: Allows access without authentication.

Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 1/6
1.3 Set folder permissions

Ensure that the folder has the right permissions:

bash

sudo mkdir -p /home/username/shared


sudo chmod 777 /home/username/shared

1.4 Restart Samba

After editing the config file, restart Samba:

bash

sudo systemctl restart smbd

1.5 Allow Samba through the firewall (optional)

If a firewall is active, allow Samba:

bash

sudo ufw allow samba

Step 2: Access the Shared Folder from Windows

2.1 Access the shared folder

On the Windows machine, press `Win + R`, then type:

css

\\IP-address-of-Linux-machine\shared

For example, if the Linux machine’s IP is `[Link]`, you would enter:

vbnet

\\[Link]\shared

To find the Linux machine's IP address, you can run:

Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 2/6
bash

ip a

2.2 Map the network drive (optional)

To make this easier in the future, you can map the shared folder as a network drive:

1. Open File Explorer.


2. Right-click on This PC or Network and select Map network drive.
3. Choose a drive letter and enter the Linux machine’s address (`\\IP-address\shared`).

Now the folder should be accessible from the Windows machine, allowing file transfers between the two
computers.

Let me know if you need further assistance!

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen
1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet [Link]/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp2s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group
default qlen 1000
link/ether d8:d0:90:43:02:6f brd ff:ff:ff:ff:ff:ff
3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
qlen 1000
link/ether c0:b5:d7:9e:18:a9 brd ff:ff:ff:ff:ff:ff
inet [Link]/24 brd [Link] scope global dynamic noprefixroute wlp3s0
valid_lft 85744sec preferred_lft 85744sec
inet6 fd9c:69d1:1782:df00:ab6:573:163d:256f/64 scope global temporary dynamic
valid_lft 7083sec preferred_lft 3483sec
inet6 fd9c:69d1:1782:df00:33f3:7ccd:9ba2:c513/64 scope global dynamic mngtmpaddr
noprefixroute
valid_lft 7083sec preferred_lft 3483sec
inet6 fe80::eb32:22a9:7101:e388/64 scope link noprefixroute
valid_lft forever preferred_lft forever

what is my ip

Your IP address is the one associated with the `wlp3s0` interface, which is your active wireless network
interface. Based on the output you shared, your IP address is:
[Link]
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 3/6
This is the local IP address of your Linux machine on your network. Use this IP to access the shared
folder from your Windows machine.

can i connect to it from my android phone ?

Yes, you can connect to the shared folder from your Android phone. To do this, you’ll need a file
manager app that supports SMB (Samba) file sharing. Here's how you can access the Linux shared folder
from your Android device:

Step 1: Install a File Manager with SMB Support

Download a file manager app from the Google Play Store that supports SMB. Some popular options
include:

CX File Explorer
Solid Explorer
ES File Explorer

Step 2: Connect to the Shared Folder

Using CX File Explorer (similar for others):

1. Open CX File Explorer and go to the Network tab.

2. Tap on "New Location" or the "+" symbol.


3. Choose SMB (Windows).
4. Enter the Linux machine’s IP address (in your case: `[Link]`).

5. Use the following credentials:


Username: (leave blank if guest access is allowed)
Password: (leave blank if guest access is allowed)
Shared Folder Name: `shared` (the name of the folder you set in your Samba configuration)
If guest access isn't allowed, enter the credentials for a valid Linux user.
6. Tap OK to connect.

Step 3: Access and Transfer Files

Once connected, you should see the contents of the shared folder. You can now upload, download, and
manage files between your Android device and the Linux shared folder.
Let me know if you need more details!

Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 4/6
if i rebooted the linux device or it shut down for a while, do i need to do something when it opens or
the sharing will we be working

After rebooting the Linux device, the Samba shared folder should automatically be available without any
additional steps, provided the Samba service is configured to start at boot.
You can check if Samba is set to start on boot and enable it if necessary with the following commands:

1. Check Samba Status:

bash

sudo systemctl status smbd

If it’s running, you’ll see a status showing it as active (running).


2. Enable Samba on Boot (if it’s not already enabled):

bash

sudo systemctl enable smbd

This ensures that Samba will start every time the Linux device boots, making your shared folder
accessible automatically after a reboot or shutdown.

is there a way to list shared folders using samba

Yes, you can list shared folders that Samba is currently sharing on a Linux machine. Here are a couple of
methods:

Method 1: Using the `smbstatus` Command

The `smbstatus` command provides information about Samba’s current status, including active shares:

bash

smbstatus --shares

This will list the shared folders (Samba shares) currently accessible on the network.

Method 2: Checking the Samba Configuration File

Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 5/6
You can also list the shared folders by checking the `/etc/samba/[Link]` file, where all Samba shares
are configured:

bash

cat /etc/samba/[Link] | grep '^\['

This command will print out only the share names by finding lines that start with `[`, which defines the
shared folders in Samba.

Method 3: Using the `net` Command

The `net` command allows you to list shares on a server:

bash

sudo net usershare list

This will display all user-defined Samba shares on the server, showing each share’s name, path, and
other details.
Using these methods, you should be able to see all active shared folders on your Samba server.

Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 6/6

You might also like