I put something like this in /etc/fstab
//server_ip_address/folder_name /mnt/folder_name cifs x-systemd.automount,x-systemd.idle-timeout=1min,rw,uid=username,gid=username,credentials=/etc/samba/private/credfile.cred,iocharset=utf8,vers=2.0 0 0
Replace server_ip
, folder_name
and username
with your actual values.
Then create /etc/samba/private/credfile.cred
with eh following contents:
username=myuser
password=mypass
myuser
and mypass
are the credentials you use to connect to the router.
Make sure that file is only readable by root.
If your share is public and you don’t need to login to read it, then you can not worry about the file and remove credentials=/etc/samba/private/credfile.cred
from the options.