# How to Mount network shares on Linux Automatically

**URL:** https://www.compsmag.com/blogs/how-to-mount-network-shares-on-linux-automatically/
**Author:** Ayushi Chauhan
**Published:** 2021-11-30
**Updated:** 2021-11-30
**Categories:** Blogs
**Tags:** Blogs Daily, Computer Guides, Google tips and tutorials, guiderobert, Guides and Tutorials, guiding12, How To Guide, How To Guides, Linux Guides, Tips, Tricks
**Reading Time:** 4 min

---

This tip is about the how to Mount network shares on Linux Automatically. So read this free guide, How to Mount network shares on Linux Automatically step by step. If you have query related to same article you may contact us.

## How to Mount network shares on Linux Automatically - Guide

In that guide, we'll go through the process of mounting a shared network drive on Linux.  The procedure is performed on Debian and Ubuntu distributions with cifs-utils and also for CentOS.  Not only can you use this method to mount a shared network drive, you can also use this method to mount other shared network locations (network share folders or other network shares).  I have a network shared storage server, the server has HDDs in RAID configuration and the storage units are network shared, I will use this configuration as an example.  In addition, the steps for permanently mounting network drives and automounting on startup are covered in this guide.

## Come back Up FStab file

Editing the fstab file is very dangerous, and any changes can seriously break your system if you mess up up.  before starting tutorial, Open up a terminal and do the following:

Create a folder on your PC to store the backup.  Also, consider uploading that backup to services like Dropbox or Google Drive to keep it safe.mkdir ~ / system backups

Get a root shell, with sudo -s, and enter /etc/directory.cd / etc /

Create the backup and place it in the backup.cp fstab / folderhome/ username / system backups

Rename the file so that it has a .bak.mv file extension fstab fstab.bak

## restore backup

Get a root shell with sudo -s.

Go into the /etc/ directory and delete the broken fstab file.cd /etc/rm fstab

Copy the backup to / etc / folder.cp /home/ username / system backups / fstab / etc /

Rename backup.mv fstab.bak fstab

## Autostart NFS

Mounting an NFS share is tedious and tedious;  especially for new users.  To people unfamiliar with NFS and how it works, it might sound like rocket science.  That's why it would be nice to be able to log in to a PC and have easy access to shares right away, with no hassle.  To do this you will need to write a line in the fstab file.

First, find the name of the share you want to mount.  For example: showmount -e 192.168.1.150

Then create a folder where NFS should be mounted in Linux.mkdir ~ / Network-Files

Open the fstab file with nano.sudo -snano / etc / fstab

Write the assembly line.  Here's an example of what it might look like: # Data from my NFS serverservername: / data /home/ username / Network-Files nfs rsize = 8192, wsize = 8192, timeo = 14, _netdev 0 0

## auto-start SAMBA

Samba is a great tool.  With it, Linux administrators can serve files over the network to the three major PC operating systems and even mobile.  Samba is widely used because of this.  Despite that, the SMB protocol is a real pain to access it manually.  File managers on Linux choke and take forever to find a share and sometimes even ignore IP addresses.  That's why it's great to be able to mount these types of shares on login.  To get started, install the CIFS utilities.  This is a set of tools that make Samba's automount of shares work correctly.

### Ubuntu

sudo apt install cifs-utils

### Debian

sudo apt-get install cifs-utils

### Arch Linux

sudo pacman -S cifs-utils

### fedora

sudo dnf install cifs-utils

### OpenSUSE

sudo zypper install cifs-utils

### Other Linuxes

CIFS is a critical component of Samba.  As a result, most Linux operating systems contain CIFS tools.  To get this package into your Linux distribution, search for “utils cifs” or something similar and install it with your package manager.

## Autostart SSHFS

SSHFS is a very useful tool for anyone working on servers.  With it, any file system can be easily shared and accessible via SSH.  However, mounting SSHFS is tedious to type.  For this reason, many people mount SSHFS automatically on boot.  Here it is how to Knife.  First, install the SSHFS package.

### Ubuntu

sudo apt install sshfs

### Debian

sudo apt-get install sshfs

### Arch Linux

sudo pacman -S sshfs

### fedora

sudo dnf install sshfs

### OpenSUSE

sudo zypper install sshfs

### Other Linux

SSHFS is widely used.  That's why users of unknown Linux distributions should have no trouble installing it.  To find it, open your package management tool, search for “sshfs” and install it.

## Final note

I hope you like the guide How to Mount network shares on Linux Automatically. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.

---

*End of Article*