Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am currently using cifs to mount some network shares (that require authentication) in /etc/fstab. It works excellently, but I would like to move the authentication details (username/pass) outside of fstab and be able to chmod it 600 (as fstab can have issues if I were to change its permissions). I was wondering if it is possible to do this (many-user system, don't want these permissions to be viewable by all users).


//server/foo/bar /mnt/bar cifs username=user,password=pass,r 0 0


//server/foo/bar /mnt/bar cifs <link to permissions>,r 0 0

(or something analogous to this). Thanks.

share|improve this question
up vote 3 down vote accepted

From the mount.cifs manpage:

    specifies a file that contains a username and/or password. The format of the file is:

   This is preferred over having passwords in plaintext in a shared file, such as /etc/fstab. Be sure to protect any credentials file properly.

share|improve this answer
Note that the vague "Be sure to protect any credentials file properly." usually means you should save the file (as root) to /root/, and chmod 700 it – Nate Parsons Apr 27 '12 at 16:46

use the credentials option such as:

example from /etc/fstab:

//server/share/   /mnt/localmountpoint   cifs   credentials=/root/.creda

janneb's post and the link to man page show what needs to be present in the credentials file.

share|improve this answer
Thanks, both answers were helpful (I should have read the manpages). If I could mark 2 answers as the correct answer I would. – tj111 Jan 13 '11 at 16:36
no worries...once I saw janneb's answer, it was clear the answer was covered :) – damorg Jan 13 '11 at 17:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.