Score:0

how to mount NAS permanently as drive even after reboot without root login?

ru flag

I have installed Ubuntu 20.04 on my laptop. It serves as a server and I would like to connect my NAS to it permanently. So also that after an automatic reboot the NAS remains mounted as a drive.

With fstab I can successfully mount it as follows:

//{NAS_IP}/MyFolder /media/NAS/ cifs username={username},password={password},rw,uid=1000,gid=500

But as soon as the laptop restarts (or shutdown and start) (with auto login) the following message appears:

"mount operation permitted for root only"

I first have to enter sudo mount -a in the terminal, then access works again. How can I embed this without entering my root password after every reboot?

thanks for your answers

Score:1
pk flag
       password=arg|pass=arg
              specifies the CIFS password. If this option  is  not  given  then  the  environment
              variable  PASSWD  is  used. If the password is not specified directly or indirectly
              via an argument to mount, mount.cifs will prompt for a password, unless  the  guest
              option is specified.

              Note that a password which contains the delimiter character (i.e. a comma ',') will
              fail to be parsed correctly on the command line. However, the same password defined
              in the PASSWD environment variable or via a credentials file (see below) or entered
              at the password prompt will be read correctly.

Use : credentials=/path/to/file instead of the userrname=...,password=...

       credentials=filename|cred=filename
              specifies a file that contains a username and/or password and optionally  the  name
              of the workgroup. The format of the file is:

                 username=value
                 password=value
                 domain=value

              This  is  preferred  over  having  passwords in plaintext in a shared file, such as
              /etc/fstab . Be sure to protect any credentials file properly.

That should work on boot. - At least it does for a couple of my Servers in various locations and setups.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.