Mount NAS over smb, but how hide the password?

Yes. Use a credential file that only root has access to.

https://wiki.archlinux.org/title/samba#Storing_share_passwords

Also, as a side note, consider using a systemd automount for network locations. It is more resilient when the network isn’t available.

<ipaddess or host name>/sharename /mnt/nas cifs x-systemd.automount,x-systemd.idle-timeout=1min,rw,user,credentials=/path/to/creds/nas.cred,iocharset=utf8,vers=2.0 0 0
2 Likes