I am looking for a way to make the mount command prompt for the password so my password doesn't show up in any system history, I thought I would have it run read -s -p command inside of the mount command but I am not having any luck with it. I am wondering if my statement is wrong and how.

mount -t cifs -o domain=domain.ad,user=thebtm,pass=$(read -s -p "password: ") "//NAS/thebtm$/" /mnt/cifsmount
password: mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

A quick look at the manual page shows:

       specifies the CIFS password. If this option is not given then the
       environment variable PASSWD is used. If the password is not
       specified directly or indirectly via an argument to mount,
       mount.cifs will prompt for a password, unless the guest option is

So, leave it unspecified, or set the PASSWD env var.


To force Centos to prompt you for a password install the following packages:


You can install these by running yum install samba-client cifs-utils as root or with sudo.

  • 2
    The OP must already have these packages because otherwise the mount command wouldn't be working at all. – roaima Jan 24 '17 at 22:31
  • Those are already installed. – thebtm Jan 25 '17 at 16:11
  • 2
    This is actually a valid solution for the problem as described in the title. Under Ubuntu, mounts.cifs is installed but it fails to mount shares with weird errors (e.g. mount is read only, username not specified, etc.) and it won't prompt for the password when it should. Installing cifs-utils somehow fixes the problem. – Malvineous Oct 25 '18 at 5:34
  • I had exactly that problem and installing these packages exactly fixed it. It was just not asking for a password and printed an error into the messages. Thumbs Up! – Chris Mar 19 at 8:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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