I can mount the Windows share drive in the following way:

mount.cifs // /mnt/share_2 -o user=wega,password=1234

but I can not in this way:

mount.cifs // /mnt/share_2 -o credentials=/root/.smbcredential_2

cat .smbcredential_2

Debugging with strace

strace -f -e trace=mount mount -t cifs // /mnt/share_2 -o credentials=/root/.smbcredential_2
Process 3338 attached
Process 3339 attached
[pid  3339] +++ exited with 0 +++
[pid  3338] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3339, si_status=0, si_utime=0, si_stime=0} ---
[pid  3338] mount("//", ".", "cifs", 0, "ip=,unc=\\\\192.168.1"...) = -1 EACCES (Permission denied)
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
[pid  3338] +++ exited with 32 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3338, si_status=32, si_utime=0, si_stime=0} ---
+++ exited with 32 +++

thank you in advance for your help

  • When you type in the command is your command prompt a "$" or a "#"? Jan 12 '16 at 9:53

Check and verify that you don't have any spaces or any other invisible characters after the username and password in your credential file.

Having extra spaces would change the credentials.

Your cat command shows several extra characters after the username entry.

  • I changed username=wega password=wega@1qazxsw2 and still the same Jan 12 '16 at 10:07
  • I reboot system and is ok:) Jan 12 '16 at 10:10
  • I forgot to thank you , thank you for your help L. D. James Jan 12 '16 at 10:13
  • @Mantykora7 I don't think you should have changed the password. Just remove the spaces from the previous file. Jan 12 '16 at 10:13
  • @Mantykora7 Glad it's working. Thanks for the acknowledgement. FYI, by the way, a reboot should not have been a criterion. Users are added to systems and passwords are changed and updated on production servers that go months and years without being rebooted. Jan 12 '16 at 10:15

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.