Simply how to share files between computer same network

I want to share a drive or folder in able to access same files from several machines on same network
Simply please no long speeches.

Hope it is short enough:
How to create a Samba share :: Fedora Docs

Are the computers needing access to these shared files all Linux, or a mixture? I have a mixture of Windows and Linux; for the Windows computers I use a Samba share as @ilikelinux suggests, and for Linux systems, an NFS share. I find NFS quite a bit easier to set up and maintain, compared to Samba, but both are stable and trouble-free for several years for my needs.

Basically it is done by acitvating file sharing on the server and connecting from clients with the file navigator, possibly using the server local IP address. See Gnome Settings > Sharing. The underlying protocol can be Samba or NFS. Some installs on server and clients might be necessary but configuration should be performed at high level, better than tweaking config files. File permissions must be adequate and most system provide users with a public folder for this purpose. You could also set up a local ftp or http server but you need to update it. Also, network storage exists, in particular, some routers provide it (like Freebox). scp is also possible.

I apologize in advance for resurrecting an old topic. I don’t know if it’s frowned-upon so I guess I’ll know better next time.

Anyways, I have two PCs at my home, both are on the same network (each having a static internal IP), both are using the same OS (F41 KDE Plasma), so I was looking for the best and easiest way to set up a shared folder between them. I came across this topic and a few tutorials:

Seeing as the latter refers to NFS on Fedora Server and is kinda complicated, I then turned to Chat GPT for an advice. It told me that, in my scenario, “NFS is the easiest and most efficient choice.”

This was the procedure that was recommended and it actually works with no issues:

Step 1: Install NFS on Both PCs

Run this on both Fedora PCs to install the required packages:

sudo dnf install nfs-utils

Enable and start the NFS server on the PC that will be sharing the folder:

sudo systemctl enable --now nfs-server

Step 2: Create the Shared Folder (on the Host PC)

Pick a folder to share or create a new one. For example:

sudo mkdir -p /mnt/shared
sudo chmod 777 /mnt/shared  # Allow all users to read/write

You can adjust permissions based on your needs.

Step 3: Configure the NFS Export

Edit the exports file to define which folders will be shared and who can access them:

sudo nano /etc/exports

Add a line like this:

/mnt/shared 192.168.1.100(rw,sync,no_root_squash)

    Replace 192.168.1.100 with the static IP of the client PC.
    rw → Read/write access.
    sync → Ensures data integrity.
    no_root_squash → Allows root access (optional, can be removed for security).

Save and exit (Ctrl + X, then Y and Enter).

Apply the changes:

sudo exportfs -rav

Restart the NFS service:

sudo systemctl restart nfs-server

Step 4: Allow NFS Through Firewall (on the Host PC)

Run:

sudo firewall-cmd --add-service=nfs --permanent
sudo firewall-cmd --reload

Step 5: Mount the Shared Folder (on the Client PC)

On the client PC, create a mount point:

sudo mkdir -p /mnt/nfs_shared

Manually mount the share (replace with the host PC's IP):

sudo mount -t nfs 192.168.1.101:/mnt/shared /mnt/nfs_shared

Check if it's mounted:

df -h | grep nfs

Step 6: Auto-Mount on Boot (Optional)

To make it mount automatically at startup, add this line to /etc/fstab on the client PC:

192.168.1.101:/mnt/shared /mnt/nfs_shared nfs defaults,_netdev 0 0

Now, the shared folder will be available after reboot.

I just remembered something. Gotta be extra careful when editing an fstab so I asked:

should i add nofail to my fstab entry in case the other pc isn’t turned on at the moment? i’d like to be able to boot this pc without the fstab denying the bootup process because it can’t find the shared folder. is my fear justified?

And it answered:

Yes, your concern is absolutely justified! If the NFS server (the other PC) is offline when the client boots, the system might hang during boot while trying to mount the unavailable NFS share.

In short, yeah, I added nofail to my fstab entry. Updated systemd, rebooted and it works.

It also gave me an alternative option, to use x-systemd.automount for on-demand mounting:

If you want the shared folder to mount only when accessed, use this instead:

192.168.1.101:/mnt/shared /mnt/nfs_shared nfs defaults,_netdev,nofail,x-systemd.automount 0 0

With this setup:

- The system won’t attempt to mount the NFS share at boot.
- It will automatically mount only when you access the folder.
- If the NFS server is down, the folder remains empty instead of causing delays.

But I only added nofail.

Yes, it is preferred to not reopen topics that have been necro for a long period.

However your post is only information and to me seems very enlightening. In fact the info from chatGPT was more accurate than most see.

The one thing I would recommend against was the suggestion to use ‘no_root_squash’ in the /etc/exports file. (security reasons)
I would also suggest using the ‘x-systemd.automount’ option in fstab. Note that option provides that it does not attempt to mount at boot, but only when accessed. If the mount fails it returns immediately instead of delaying for a timeout on the failed mount.

1 Like