Mount NAS over smb, but how hide the password?

Hi,
I mount my NAS over smd with the following in the fstab (not my actual values):

mount -t cifs -o user=[User Name],password=[Password] //192.168.1.1/share /mnt/nas

That works fine, but in the fstab everyone can read my password…

Is there a possibility to hide or even encrypt the password?

thx,
Daniel

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

Thanks, that was fast!

with the password works flawless and I changed fstab as you advised.

thx!!!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.