sudo mount -t cifs //server/share /mnt/share -o credentials=/etc/samba/credentials

Category: Local Network & Public Hosting

sudo mount -t cifs //server/share /mnt/share -o credentials=/etc/samba/credentials

Mount a share using a credentials file

Instead of a password on the command line, this reads username, password, and domain lines from /etc/samba/credentials, which keeps secrets out of shell history and process listings. Protect that file with root-only permissions. The credentials option is the recommended form for fstab entries.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.