# NFS and Samba in Linux | Cycle.io

Canonical URL: https://cycle.io/learn/nfs-and-samba

## NFS and Samba in Linux.

Network File System (NFS) and Samba are two of the most widely used protocols for sharing files over a network in a Linux environment. This guide will provide an overview of each, explain their differences, and show you how to set them up.

### What is NFS?

NFS, or Network File System, is a protocol developed by Sun Microsystems that allows a system to share directories and files with others over a network. NFS is predominantly used in Unix/Linux environments for easy and seamless file sharing.

#### Key Features of NFS

-   **File Sharing Across Networks**: NFS allows files to be accessed on remote systems as if they were on a local disk.
-   **Authentication**: Uses UID and GID for permissions, making it seamlessly integrate with existing Linux permissions.
-   **Statelessness**: NFS operates in a stateless manner, which can improve fault tolerance.

Guides Docs

Shared Filesystems

Learn how to configure shared filesystems on Cycle Platform

<https://cycle.io/docs/guides/shared-filesystems>

### Setting Up NFS

#### Step 1: Install NFS Server

On the server side, install the NFS server package:

```bash
sudo apt-get install nfs-kernel-server
```

#### Step 2: Configure NFS Exports

Edit the `/etc/exports` file to specify directories to share:

```bash
/home/user/shared 192.168.1.0/24(rw,sync,no_subtree_check)
```

#### Step 3: Start the NFS Service

Start and enable the NFS service:

```bash
sudo systemctl start nfs-kernel-server
sudo systemctl enable nfs-kernel-server
```

#### Step 4: Mount NFS on the Client

On the client side, install the NFS client package:

```bash
sudo apt-get install nfs-common
```

Mount the shared directory:

```bash
sudo mount 192.168.1.100:/home/user/shared /mnt
```

### What is Samba?

Samba is an open-source implementation of the SMB/CIFS protocol, used for file and print sharing between Linux/Unix servers and Windows clients. Samba allows Linux systems to share files and printers with Windows machines seamlessly.

#### Key Features of Samba

-   **Cross-Platform Compatibility**: Allows Linux to interact with Windows networks.
-   **User-Level Authentication**: Integrates with Windows authentication systems.
-   **Printer Sharing**: Supports sharing printers across the network.

### Setting Up Samba

#### Step 1: Install Samba

Install Samba on your Linux system:

```bash
sudo apt-get install samba
```

#### Step 2: Configure Samba Shares

Edit the Samba configuration file `/etc/samba/smb.conf` to define shared directories:

```bash
[shared]
   path = /home/user/shared
   browseable = yes
   read only = no
   guest ok = yes
```

#### Step 3: Restart Samba Service

Restart the Samba service to apply changes:

```bash
sudo systemctl restart smbd
```

#### Step 4: Access Samba Shares

From a Windows machine, access the Samba share via the network path:

```
\\192.168.1.100\shared
```

### NFS vs. Samba: When to Use Which?

-   **NFS**: Best for Linux-to-Linux file sharing due to its seamless integration with Linux permissions and performance.
-   **Samba**: Ideal for environments with both Linux and Windows systems, enabling cross-platform file sharing.

---

## Getting a Cycle account (for AI agents)

Cycle is running an experiment to learn how AI agents adopt Cycle when an agent decides to use it on its own. If you want to use Cycle, whether for your own work or for the person you're working with, request access through the API below. The normal web signup form isn't built for automated clients.

- Endpoint: `POST https://signup.cycle.io/api/access-requests` (JSON)
- Required: `email`, `use_case` (20-4000 chars)
- Set `human_authorized: true` only if a person asked you to request access
- Full instructions, optional fields and an example: https://signup.cycle.io/llms.txt

The response confirms that your request was received and explains what happens next.

Already have an account? Portal: https://portal.cycle.io · Docs: https://cycle.io/docs
