Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 {Help Needed} How to permanently mount, NAS network folder to Debian based Linux

views
     
TSpetrofsky77
post Mar 10 2023, 09:39 AM, updated 2w ago

Temet nosce
******
Senior Member
1,499 posts

Joined: Jan 2006
From: Neither here nor there



Hi,

As the title implies, I am trying to create a permanent mount from my Zorin OS 16.2 to my Synology NAS network share folder. I have no issues connecting to the folder via GUI, but I'm trying to get it auto mounted everytime the OS restarts. I have tried installing all SMB, NFS & CIFS dependency modules, edited and added the /etc/fstab file, but nothing seems to work. Anybody here knows what is the correct way of doing it?
empstar2
post Mar 10 2023, 10:01 AM

Getting Started
**
Junior Member
96 posts

Joined: Jan 2022
ask xxboxx

https://forum.lowyat.net/topic/5062470
angch
post Mar 10 2023, 10:20 AM

On my way
****
Junior Member
576 posts

Joined: Jul 2006
At a whim, after I got stuck trying to remember what package mount.cifs comes in, I asked chatgpt:

user posted image

It appears to be correct. Fun. I also learned that there's the credential files option which I never used (hardcoded username/password in fstab).

QUOTE
To mount a CIFS (Common Internet File System) network share on Linux startup using /etc/fstab, you can follow these steps:

Create a mount point: First, create a directory that will serve as a mount point for the network share. For example, you can create a directory called /mnt/nas.

CODE
sudo mkdir /mnt/nas


Find out the network share details: You will need to know the IP address or hostname of the NAS device and the path to the shared folder that you want to mount. For example, let's say the IP address of the NAS device is 192.168.1.100 and the shared folder you want to mount is called share.

Install cifs-utils: You need to have the cifs-utils package installed to mount CIFS network shares. If you don't have it installed, you can install it with the following command:

CODE
sudo apt-get install cifs-utils

Edit /etc/fstab: Open the /etc/fstab file in a text editor. Add the following line at the end of the file to mount the CIFS network share:
CODE
//192.168.1.100/share /mnt/nas cifs credentials=/home/user/.smbcredentials,uid=1000,gid=1000 0 0

Here, replace 192.168.1.100 with the IP address or hostname of your NAS device and share with the name of the shared folder. Also, replace /home/user/.smbcredentials with the path to the credentials file. You can create a credentials file with the username and password to access the network share as follows:

CODE
sudo nano /home/user/.smbcredentials

Add the following lines to the file, replacing username and password with your actual login credentials:

CODE
username=<your_username>
password=<your_password>

Make sure to secure the .smbcredentials file so that only you have read and write access to it. You can do this with the following command:

CODE
sudo chmod 600 /home/user/.smbcredentials

Save and close /etc/fstab: Save the changes to the /etc/fstab file and close the text editor.

Test the mount: You can test the mount by running the following command:

CODE
sudo mount -a

This command will attempt to mount all entries in /etc/fstab. If there are any errors, it will print them to the console.

Reboot your system: After testing, reboot your system to ensure that the network share is mounted on startup.
Once you have completed these steps, the network share will be mounted automatically at startup. You can access it at the mount point you created (in this example, /mnt/nas).
This post has been edited by angch: Mar 10 2023, 10:21 AM
flashang
post Mar 10 2023, 10:40 AM

Getting Started
**
Junior Member
194 posts

Joined: Aug 2021


QUOTE(angch @ Mar 10 2023, 10:20 AM)
At a whim, after I got stuck trying to remember what package mount.cifs comes in, I asked chatgpt:

user posted image

It appears to be correct. Fun. I also learned that there's the credential files option which I never used (hardcoded username/password in fstab).
*
Not sure should give you or ChatGpt a "like" ...

tongue.gif


TSpetrofsky77
post Mar 10 2023, 11:10 AM

Temet nosce
******
Senior Member
1,499 posts

Joined: Jan 2006
From: Neither here nor there



QUOTE(angch @ Mar 10 2023, 10:20 AM)
At a whim, after I got stuck trying to remember what package mount.cifs comes in, I asked chatgpt:

user posted image

It appears to be correct. Fun. I also learned that there's the credential files option which I never used (hardcoded username/password in fstab).
*
Hey thanks! Didn't occur to me to ask ChatGPT for help! Shall try it out and report my findings here.

Quick Update (as of 11.29 AM, Fri 10/3/2023) : It works! I have restarted the OS a few times and the mount point is persistent now! Thanks a bunch!

This post has been edited by petrofsky77: Mar 10 2023, 11:30 AM

 

Change to:
| Lo-Fi Version
0.0115sec    0.23    5 queries    GZIP Disabled
Time is now: 23rd March 2023 - 05:59 AM