Mount NAS over smb, but how hide the password?

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] // /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?


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

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
1 Like

Thanks, that was fast!

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


1 Like

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