Create network shares
You may have the need to share files and folders on your Gentoo PC with other files on the network. There are two primary ways of doing this, and these methods are using nfs or samba. Samba is geared towards compatibility with Microsoft Windows, whereas nfs is an abbreviation for network file system, and has its roots in the early days of unix.
On order to create a samba or nfs share, you'll need to make sure you have the proper kernel config. The necessary options are shown in the kernel section.
To create an nfs share, you'll first need to emerge the net-fs/nfs-utils package.
$ sudo emerge -av nfs-utils
Once the package has been emerged, we can configure the exports, which are the folders we're sharing and the access level and permissions for clients. In the example below, we will share the folder /home/gr0x0rd to some other machines on the network.
$ sudo nano -w /etc/exports
/etc/exports
# /etc/exports: NFS file systems being exported. See exports(5). /home/gr0x0rd 192.168.0.100(rw,no_subtree_check) /home/gr0x0rd 10.10.3.119(rw,no_subtree_check)
Once you have saved your exports file, we can start the nfs server.
$ sudo /etc/init.d/nfs start
To start the nfs server with the system,
$ sudo rc-update add nfs default
You should now be able to mount the share from another machine on your network.