I know this question has been asked before, but I’ve been looking for a solution for a couple of hours now and nothing seems to be working.
The frustrating thing is that it used to work on my previous install, so I know the commands I try should work.
I’m running a vanilla install of Ubuntu 13.04 server.
I have a server running at 192.168.1.130 and two shares: LaCie and Seagate 2TB.
I used to have these lines in my fstab
file:
//192.168.1.130/Seagate402TB /home/Windows cifs user=admin,password=password,uid=1000 0 0
Now that I re-installed my server, but don’t need it permanently I tried the following:
sudo mount.cifs //192.168.1.130/LaCie ~/lacie -o user=admin
or
sudo mount -t cifs -o username='admin',password='<password>' //192.168.1.130/LaCie ~/lacie
However, I get the error mount error(13): Permission denied
.
I’m sure the credentials are correct. Nothing has changed at the windows side.
Also, I installed the packages samba
, cifs-utils
too. Nothing helped.
A couple of things to check out. I do something similar and you can test mount it directly using the mount
command to make sure you have things setup right.
Permissions on credentials file
Make sure that this file is permissioned right.
$ sudo ls -l /etc/smb_credentials.txt
-rw-------. 1 root root 54 Mar 24 13:19 /etc/smb_credentials.txt
Verbose mount
You can coax more info out of mount
using the -v
switch which will often times show you where things are getting tripped up.
$ sudo mount -v -t cifs //server/share /mnt
-o credentials=/etc/smb_credentials.txt
Resulting in this output if it works:
mount.cifs kernel mount options: ip=192.168.1.14,unc=\servershare,credentials=/etc/smb_credentials.txt,ver=1,user=someuser,domain=somedom,pass=********
Check the logs
After running the above mount command take a look inside your dmesg
and /var/log/messages
or /var/log/syslog
files for any error messages that may have been generated when you attempted the mount
.
Type of security
You can pass a lot of extra options via the -o ..
switch to mount. These options are technology specific, so in your case they’re applicable to mount.cifs
specifically. Take a look at the mount.cifs
man page for more on all the options you can pass.
I would suspect you’re missing an option to sec=...
. Specifically one of these options:
sec=
Security mode. Allowed values are:
· none - attempt to connection as a null user (no name)
· krb5 - Use Kerberos version 5 authentication
· krb5i - Use Kerberos authentication and forcibly enable packet
signing
· ntlm - Use NTLM password hashing
· ntlmi - Use NTLM password hashing and force packet signing
· ntlmv2 - Use NTLMv2 password hashing
· ntlmv2i - Use NTLMv2 password hashing and force packet signing
· ntlmssp - Use NTLMv2 password hashing encapsulated in Raw NTLMSSP
message
· ntlmsspi - Use NTLMv2 password hashing encapsulated in Raw
NTLMSSP message, and force packet signing
The default in mainline kernel versions prior to v3.8 was sec=ntlm.
In v3.8, the default was changed to sec=ntlmssp.
You may need to adjust the sec=...
option so that it’s either sec=ntlm
or sec=ntlmssp
.
References
- Thread: mount -t cifs results gives mount error(13): Permission denied
I am struggling to mount a windows 2008 share on a CentOS 6.4 (64 bits) server
when I use smbclient it works:
smbclient //esb.local/dfs -U ESBSertal -W ESB -P MyPassword
but with mount it does not. I tried on the command line:
mount.cifs //esb.local/dfs -o username=ESBSertal,password=MyPassword,domain=ESB /mnt/win
and adding a line to /etc/fstab
//esb.local/dfs /mnt/win cifs username=ESBSertal,password=MyPassword,domain=ESB 0 0
in both cases I get the same error:
mount.cifs //esb.local/dfs -o username=ESBSertal,password=MyPassword,domain=ESB /mnt/win
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
and for fstab
mount -a
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
I am grateful for your support.
just an update: this is executed as root. neither as root nor sudo work
Micha
Are you struggling with CentOS mount error(13) Permission Denied error? Worry not, our experts have the solution. Our Server Management Support team is here to offer a lending hand with your queries and issues.
CentOS mount error(13) Permission Denied: How to fix
Some of our customers approached us when they ran into the mount error(34): Permission denied error while attempting to mount a windows share when running Kernel. This error occurs even if the username and password are accurate. Fortunately, our experts helped resolve this issue in no time.
According to our experts, we have to specify NTLM support to avoid this issue. We can do this by adding “sec=ntlm” to the mount command as seen below:
Alternatively, if the issue is with the user=domainmyuser syntax, we can resolve it by:
However, since we cannot use the password in the CLI, we can use the following entry in /etc/fstab for the final mount of the windows share:
Let us know in the comments which fix helped you resolve the CentOS mount error(13) error.
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
To conclude, our Support Engineers demonstrated how to resolve the CentOS mount error(13) Permission Denied error using two different methods.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
GET STARTED
There are a couple of ways how to mount a CIFS/Samba share on a Linux client. However some tutorials are outdated and meanwhile completely wrong. I just ran into a (stupid) case of a wrong mount.cifs syntax:
root@focal:~# mount -t cifs //server/Share /mnt -o rw,user=domainmyuser,password=secret
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
Unfortunately, the additional output in dmesg is not helpful to figure out the problem:
root@focal:~# dmesg
[…]
[16444886.307684] CIFS: Attempting to mount //server/Share
[16444886.307717] No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3 (or SMB2.1) specify vers=1.0 on mount.
[16444886.539770] Status code returned 0xc000006d STATUS_LOGON_FAILURE
[16444886.539795] CIFS VFS: \server Send error in SessSetup = -13
[16444886.539901] CIFS VFS: cifs_mount failed w/return code = -13
After additional try and errors (and looking up a recent share mount from the history), the problem turned out to be the user=domainmyuser syntax. This way of combining the domain/workgroup and the username is not working (anymore).
Note: Both user= and username= are accepted in the options.
Instead use:
root@focal:~# mount -t cifs «//server/Share» /mnt -o «user=myuser,password=secret,workgroup=DOMAIN»
root@focal:~# ll /mnt/
total 0
drwxr-xr-x 2 root root 0 Sep 1 2020 _Archiv
drwxr-xr-x 2 root root 0 Aug 9 12:10 Client
[..]
This way it worked.
Of course the password should not be used on the command line, so for the final (and automatic) mount of the share use the following entry in /etc/fstab:
root@focal:~# cat /etc/fstab
[…]
# Mount CIFS share from server
//server/Share /mnt cifs rw,relatime,vers=3.1.1,credentials=/etc/samba/servershare.conf,uid=0 0 0
Where /etc/samba/servershare.conf contains the credentials:
root@focal:~# cat /etc/samba/servershare.conf
user=myuser
password=secret
domain=DOMAIN
Add a comment
Show form to leave a comment
Comments (newest first)
Edgardo Pannunzio (KERNEL Consultores) from Uruguay wrote on Feb 9th, 2023:
Thanks very much !!
Your post was really helpful.
Ed from wrote on Jan 27th, 2023:
In my case (mounting win 2019 share in RHEL9) when using double apostrophe: «user=myuser…» was outputing:
«bash: !,workgroup=$MY_DOMAIN: event not found»
Switching to single apostrophe ‘user=mysers…’ did the trick
ck from Switzerland wrote on Nov 29th, 2022:
Keith, make sure you have the cifs-utils and smbclient packages installed on your Ubuntu. Still an error? Try to connect to the share using the smbclient command. It could also be a SMB protocol mismatch. Check out this article, describing Samba protocol configuration on the client.
Keith from United States wrote on Nov 29th, 2022:
I’ve tried for the past 3 hours, 5AM in the morning now, and I’ve tried everything from every other website and this one and still get the exact same errors. Tried it with just sudo, then root. Same thing. Host OS is ubuntu server trying to mount a network share from my Synology NAS.
AJav from wrote on Sep 19th, 2022:
very good, Thanks !
simonpunk2016 from wrote on Aug 1st, 2022:
Thank you sir, never know the mount option has changed, because I just successfully mounted the cifs last month, thought my Manjaro has come to an end.
simonpunk2016 from wrote on Jul 29th, 2022:
Thank you sir, never know the mount option has changed, because I just successfully mounted the cifs last month, thought my Manjaro has come to an end.
Jesko from wrote on Feb 10th, 2022:
I had exact the same error, but different reason. On a freshly installed (old) Ubuntu 16.04 LTS (last 32Bit version). My reason was: There was no cifs-utils installed! so «sudo apt install cifs-utils» was the solution. I just write here because I crawled through hundreds of comments.