Here are the steps to mount a network drive permanently on a Linux system:

Step 1: Install the necessary packages

You will need to install the cifs-utils package to mount a network drive on a Linux system. You can install it using the following command:

sudo apt-get install cifs-utils


Step 2: Create a mount point

Create a mount point for the network drive. This will be the directory where the network drive will be mounted. For example:

sudo mkdir /mnt/network-drive

Step 3: Mount the network drive

Mount the network drive using the mount command. You will need to specify the IP address or hostname of the server, the share name, and the mount point. For example:

sudo mount -t cifs //192.168.1.100/share /mnt/network-drive -o username=myusername,password=mypassword

Step 4: Add the mount to /etc/fstab

To mount the network drive permanently, you need to add an entry to the /etc/fstab file. This file contains a list of file systems that are mounted automatically when the system boots.

Open the /etc/fstab file in a text editor and add the following line:

//192.168.1.100/share /mnt/network-drive cifs username=myusername,password=mypassword 0 0

Step 5: Test the mount

Reboot the system and test the mount by checking if the network drive is mounted correctly.

df -h


This should show the network drive mounted at the specified mount point.

Step 6: Make the mount secure

To make the mount secure, you can use a credentials file instead of specifying the username and password in the /etc/fstab file.

Create a credentials file:

sudo nano /etc/credentials


Add the following lines:

username=myusername
password=mypassword
Make the file readable only by root:
sudo chmod 400 /etc/credentials


Update the /etc/fstab file to use the credentials file:

//192.168.1.100/share /mnt/network-drive cifs credentials=/etc/credentials 0 0


This will mount the network drive securely using the credentials file.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *