Linux/Automount Network Shares
From charlesreid1
Contents
With the usual caveats to be careful editing the /etc/fstab file, as you can disable your ability to boot with a single typo...
fstab
Start with your existing /etc/fstab
file. Here is a sample:
# root filesystem UUID=9f60d333-5a92-4e27-a83a-52f4a033cebf / ext4 errors=remount-ro 0 1 # swap UUID=c9139e0a-19b0-4478-a86e-a5d0ee4f74a4 none swap sw 0 0
adding nfs to fstab
Add the files to include the NFS share:
10.5.5.5:/share/documents /mnt/documents nfs users,rw,auto,nolock,x-systemd.automount,x-systemd.device-timeout=10 0 0
This accesses the NFS shares at the IP address 10.5.5.5
, specifically the ones at /share/documents
, and mounts them locally at /mnt/documents
.
The various options do things like telling to keep the drive mounted if possible, not to wait longer than 10 seconds for the share if it is unavailable on the network, and end the line with 0 to indicate no consistency check is needed on boot. (systemd is required for the x-systemd.automount option to be understood).
adding samba to fstab
Samba shares can be added to /etc/fstab
similarly:
//10.5.5.5/Documents /samba cifs username=asdfasdfasdfasdf 0 0
perhaps you don't want network shares to AUTOMATICALLY mount. in that case, you can add the noauto
option, like this:
NFS
For NFS:
10.5.5.5:/share/documents /mnt/documents nfs users,rw,noauto,nolock,x-systemd.device-timout=10, 0 0 0
Now, if you want to mount your documents, you just run the command
$ mount /mnt/documents
which replaces the more awkward
$ mount -t nfs 10.5.5.5:/exports/documents /mnt/documents
Samba
for Samba:
//10.5.5.5/documents /samba/documents cifs noauto,username=asdfasdfasdfasdf 0 0
Now you can type
$ mount /samba/documents
Related
Networking pages and notes about computer networks.
Man in the Middle attack vectors on wired networks: Man in the Middle/Wired Packet analysis with Wireshark: Packet Analysis Linux networking: Linux/Networking
Using Aircrack: Aircrack Many Ways to Crack a Wifi: Cracking Wifi
Linux/Networking · Linux/SSH · Linux/File Server
Notes on OpenVPN: OpenVPN Setting Up a Static Key VPN: OpenVPN/Static Key
Domain Name Servers: DNS · Linux/DNS IP Version 6: IPv6
Wireshark · SSH · Stunnel · Tor · Ettercap · Aircrack · Tcpdump
Tunnels · HTTP and HTTPS · SSH Tunnels · Linux/SSH
|
GNU/Linux/Unix the concrete that makes the foundations of the internet.
Compiling Software · Upgrading Software Category:Build Tools · Make · Cmake · Gdb Bash Bash · Bash/Quick (Quick Reference) · Bash Math Text Editors Text Manipulation Command Line Utilities Aptitude · Diff · Make · Patch · Subversion · Xargs Security SSH (Secure Shell) · Gpg (Gnu Privacy Guard) · Category:Security Networking Linux/SSH · Linux/Networking · Linux/File Server Web Servers
|
linux networking all the pages for linux networking
Diagnosing network interfaces: Linux/Network Interfaces Connecting to nodes with ssh: Linux/SSH Bridging networks with ssh tunnels: Linux/SSH Linux file server nfs/smb/sshfs: Linux/File Server Samba on linux: Linux/Samba Automounting network shares on linux: Linux/Automount Network Shares Monitoring system resources: Linux/System Monitoring Linux systemd: Linux/Systemd
IP Schema (ipcalc): Linux/IP Schema DHCP Server: Linux/DHCP DNS Server: Linux/DNS NTP Server: Linux/NTP
|