Best way for that would be to utilize /etc/fstab
. I was struggling with that some time ago, so please find a line that finally worked for me. In my case it cooperates well with ksmbd of OpenWrt.
//192.168.150.1/myshare /mnt/myshare cifs vers=3.0,nobrl,domain=lan,username=username,password=usernamepassword,x-systemd.automount,x-systemd.requires=network-online.target,_netdev,uid=1000,gid=1000,rw 0 0
Some additional hints:
- always try to define protocol version.
- if you connect through wifi, setup your connection as one other users can connect (NetworkManager setting).
- always use IP instead of host.