The cart is empty

In the modern digital landscape, the need to share files and data across different computers within the same network is common. Linux offers several tools and protocols for managing network file systems, particularly NFS (Network File System) and CIFS (Common Internet File System), known for their flexibility and widespread support. This article focuses on how to set up and manage these systems.

NFS - Network File System

1. Installation and Configuration of NFS Server

First, you need to install the NFS server. On Debian and derivatives, you can do this with the command:

 

sudo apt-get install nfs-kernel-server

For CentOS or RHEL, use:

sudo yum install nfs-utils

After installation, open the NFS configuration file /etc/exports and add lines for the directories you want to share. An example configuration for sharing the directory /srv/nfs with full access for the network 192.168.1.0/24 would look like this:

/srv/nfs 192.168.1.0/24(rw,sync,no_subtree_check)

After modifying the configuration file, restart the NFS server to apply the changes:

sudo systemctl restart nfs-kernel-server

2. Connecting to the NFS Server

On the client, use the mount command to connect to the shared directory:

sudo mount -t nfs <nfs_server_ip>:/srv/nfs /mnt

 

CIFS - Common Internet File System

1. Installation and Configuration of Samba Server for CIFS Sharing

CIFS is often implemented via the Samba server. To install the Samba server on Debian and its derivatives, use:

 

sudo apt-get install samba

For CentOS or RHEL:

sudo yum install samba samba-client

After installation, open the Samba configuration file /etc/samba/smb.conf and add a configuration for the shared directory. An example for sharing the directory /srv/samba looks like this:

[sambashare]
   comment = Samba Share
   path = /srv/samba
   read only = no
   browsable = yes

Then restart the Samba server:

sudo systemctl restart smbd

2. Connecting to CIFS/Samba Share

On the client, you can connect to the share using the mount command with the cifs type option:

sudo mount -t cifs //nfs_server_ip/sambashare /mnt -o username=<uživatel>,password=<heslo>

 

Security and Further Steps

When managing network file systems, security considerations are crucial. This includes using firewalls, encrypting connections, and managing access rights. NFSv4 offers improved security features including encryption, while using CIFS, securing the connection with SMB3 is recommended.

For advanced administrators, it's possible to customize the configuration for higher performance, reliability, and availability, such as using NFS in conjunction with Kerberos or configuring the Samba server to work in an Active Directory domain.

In conclusion, NFS and CIFS are fundamental tools for file sharing in Linux networks. Proper configuration and management ensure efficient and secure access to files across various systems.