I can mount the Windows share drive in the following way:
mount.cifs //192.168.1.151/_wymiana /mnt/share_2 -o user=wega,password=1234
but I can not in this way:
mount.cifs //192.168.1.151/_wymiana /mnt/share_2 -o credentials=/root/.smbcredential_2
cat .smbcredential_2
username=wega
password=1234
Debugging with strace
strace -f -e trace=mount mount -t cifs //192.168.1.151/_wymiana /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("//192.168.1.151/_wymiana", ".", "cifs", 0, "ip=192.168.1.151,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
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.