2

I have two mount statements in the fstab file but they dont work. Here is an example- I can do a sudo mount with the text below, it works perfectly.

sudo mount //192.168.0.200/Movies /mnt/NAS1HD -o username=XXX,password=XXX

But the below line in /etc/fstab does not mount the share.

//192.168.0.200/Movies  /mnt/NAS1HD  cifs username=XXX,password=XXX,iocharset=utf8,sec=ntlm  0  0 

I am new to linux so I am sure I have some bad syntax and cannot figure it out.

Thanks in advance!

  • 2
    //192.168.0.200/movies vs //192.168.0.200/Movies. I don't know if this is a typo in your question, but remind, Linux is case sensitive! – mook765 Oct 7 '18 at 4:53
  • Yeah, typo in my question. I learned that this evening working on this issue. – Rob L. Oct 7 '18 at 5:04
  • (1) Your fstab statemnt has the option "sec=ntlm" whereas the manual mount does not. (2) It does not mount the share at boot? Or it doesn't mount at all? In other words after login does it mount if you open a terminal and run 'sudo mount -a' without quotes. – Morbius1 Oct 7 '18 at 12:13
  • Sorry I should be clearer in my response, I've updated the text to do that. (1)I didnt need it for the mount command but found sec=ntlm listed in everything I found to get fstab working. (2)Boot (/etc/fstab) does not work while sudo mount does work. – Rob L. Oct 7 '18 at 21:44
1

I didn't quite get the answer to my (2) question so let's do it this way:

** sec=ntlm is very much a legitimate option that still works but since you can mount the share manually without it I don't think you need it. Remove it from your fstab statement.

** Reboot your machine.

** Verify that it did not mount by going to /mnt/NAS1HD

** Then run this command:

sudo mount -a

Did it mount now?

If it did mount after runningsudo mount -a then it's likely your fstab is being read before the network stack is up during the boot process. One way to "fix" this is:

[1] Create a new file at: /etc/network/if-up.d/fstab

[2] Add this content:

#!/bin/sh
mount -a

[3] Make the file executable:

sudo chmod +x /etc/network/if-up.d/fstab

Any script placed in if-up.d will run only after the network is up and operational so this should fix the timing issue if fstab is read too early in the boot process.

| improve this answer | |
  • Instead, adding _netdev to the option list, should achieve the same in a more standardized way. – Soren A Oct 8 '18 at 11:47
  • The reason I suggested the script is because the time-honored use of _netdev doesn't seem to do what it once did and I'm not sure why. Theoretically systemd knows to wait for the network on a cifs mount so both of our suggestions should be unnecessary. Maybe it's the interference with systemd or maybe it's the definition of what constitutes the network being "up". – Morbius1 Oct 8 '18 at 12:16
  • That fixed it, I was using sec=ntlm which as stated is no longer supported. I removed that section, rebooted and the mounts were in place. Thank you for the help and solution! – Rob L. Oct 10 '18 at 0:37
1

@rob-l - if the fileserver where your movies directory is sharing with SMB3.0 for Windows 10, and you need credentials to access the files, you need to change the security options from ntlm to ntlmssp. Then to grant permissions to read write, you need to specify user group gid or user uid. Easiest to specify a user than a group, otherwise you'll need to convert the Windows Security Group to a Unix gid.

//192.168.0.200/Movies  /mnt/NAS1HD  cifs username=XXX,password=XXX,iocharset=utf8,sec=ntlm  0  0  ```

Then, if you want it to mount when it receives connectivity, use _netdev as the final option

//192.168.0.200/Movies  /mnt/NAS1HD  cifs uid=ubuntuusername,username=XXX,password=XXX,iocharset=utf8,sec=ntlmssp,_netdev  0  0 

You can also store the credentials in a file with permissions:

echo username=NETWORKUSERNAME > ~/.smbcredentials
echo password=NETWORKPASSWORD >> ~/.smbcredentials
CHMOD 600 ~/.smbcredentials
//192.168.0.200/Movies  /mnt/NAS1HD  cifs uid=ubuntuusername,credentials=/home/ubuntuusername/.smbcredentials,iocharset=utf8,sec=ntlmssp,_netdev  0  0 

... and just reading through the rest of the stuff here, what organic-marble has vers=3.0 is an alternate choice to sec=ntlmssp

| improve this answer | |
0

Delete sec=ntlm. This hasn't worked since 17.10, but there are a lot of old web pages that still advise you to include it.

This is a [redacted] example of a working line from my 18.04 fstab.

//[IP address]/ST8-E-Drive /media/ST8-E-Drive cifs vers=3.0,credentials=/home/[username and file],iocharset=utf8,file_mode=0777,dir_mode=0777,uid=[uid],gid=[gid],nofail 0 0
| improve this answer | |
0

I think the ifupdown package is outdated in Ubuntu 18.04 and replaced by netplan.io. Anyway, delayed mount from fstab is not working for me.

I also tried systemd .mount files with no success The only (ugly) solution I found is write a cronjob that executes mount -a every minute.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.