Long time, first time. I'm running RHEL 7.2 (Maipo), and unable to mount a NAS using credentials stored in a file. The directory mounts successfully if I pass username and password directly in the command line, but I'd like to use a credentials file instead for security reasons
$ sudo mount -t cifs -o username=myname,password=mypassword //mydomain/share/Users/me /mnt/mydir # Success $ printf "username=myname\npassword=mypassword\n" >> mycreds $ sudo mount -t cifs -o credentials=mycreds //mydomain/share/Users/me /mnt/mydir # error 2 (No such file or directory) opening credential file mycreds
The password only contains alphanumeric characters, so it's not an issue with special characters.
Permissions on the credentials file are currently set as follows. I started out as the file owner, but that didn't work either.
$ ls -l mycreds # -rwSr-xr-x. 1 root root 40 Mar 19 18:23 mycreds
mount.cifs --version returns
mount.cifs version: 6.2
I haven't added any lines to /etc/fstab while testing
mount. I'd like to verify it works from command line first.
Let me know if more information would help!