1

I have a cifs share connectin a windows folder to a debian machine, however I cannot get it to mount on boot using fstab. I have the credentials stored in a file with 600 permissions.

//192.168.1.72/Wowcher_Order_System     /root/wowcher   cifs    credentials=/root/.smbcredentials,iocharset=utf8,sec=ntlm      0       0

The credentials are saved like this:

username=user
password=pass

Is there anything obvious I am doing wrong? The share works if I manually mount it.

Edward144
  • 135
  • 3
  • 11
  • "Manually" means without `fstab`? or just `sudo mount /root/wowcher`? If the latter works then your problem may be because network is unavailable when this `fstab` entry is parsed. Does your Debian use `systemd`? Aside from this: have you considered `autofs`? – Kamil Maciorowski Aug 25 '17 at 15:44
  • Manually is either: mount -t cifs //192.168.1.72/Wowcher_Order_System /root/wowcher -o username=user,password=pass. Or if i just run mount -a – Edward144 Aug 25 '17 at 15:46
  • What does the appropriate fstab line read? I postulate the 4th field is wrong (does it say auto,defaults or something else?) – davidgo Aug 25 '17 at 15:50
  • @davidgo The fstab line is what I have posted above in the code box. I don't have auto default or anything else – Edward144 Aug 25 '17 at 15:52
  • If `mount -a` works then I think the entry is OK. I suspect you should delay mounting until your network is up. Are you sure this is not the issue? – Kamil Maciorowski Aug 25 '17 at 15:55
  • @KamilMaciorowski I'm not sure about that, the windows pc is on all the time, and I wouldn't think the linux machine would try to mount before it has finished starting up (including connecting to the network) How can I delay it? – Edward144 Aug 25 '17 at 15:57
  • Sorry, my money truncated it. Answer below. – davidgo Aug 25 '17 at 15:58
  • [`autofs`](https://superuser.com/a/606707/432690) instead of `fstab` entry. – Kamil Maciorowski Aug 25 '17 at 15:58

3 Answers3

3

The issue is you do not have "auto" in the options field of fstab, so it's not automatically mounting. Add",auto" to the end of the 4th field and that should fix it.

Mount -a will mount files without this flag, but they won't mount during startup.

davidgo
  • 68,623
  • 13
  • 106
  • 163
1

You must add those two options:

  • auto (as stated by @davidgo) for this mount point to be loaded upon startup
  • _netdev for boot script to wait network before loading it

You can also add few more speed and safety options like relatime,nodev and maybe nosuid,noexec.

See man mount for available options.

A. Loiseau
  • 1,198
  • 7
  • 6
0

I have same issue but wasn't fixed adding both _netdev and auto ???

//192.168.0.50/Pool /mnt/pool cifs username=USER,password=PASS,vers=3.0,uid=1000,_netdev,auto 0 0

When it works fine with sudo mount -a ???

  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://superuser.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://superuser.com/help/whats-reputation), you can also [add a bounty](https://superuser.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/1211738) – Toto Aug 22 '23 at 15:32