Mounting Windows shares using cifs results in "Error:13(Permission denied)"

21,049

I am having the same issue. However by adding osec flag seems to be working for me. I cannot create any new file/folder, but can write to the existing files.

//{ip_address}/{sharename}  /mnt/server1  cifs (rw,nodev,uid=0,gid=0,credentials=/home/{user}/.smbcredentials,iocharset=utf8,file_mode=777‌​,dir_mode=777,osec=ntlmv2) 0 0

I have this on the /etc/fstab file.

Share:
21,049
E.nunez
Author by

E.nunez

Updated on September 18, 2022

Comments

  • E.nunez
    E.nunez almost 2 years

    Ubuntu 12.04.1 LTS, kernel 3.2.0-57-generic Windows Server 2008 R2 SP1 x64

    Trying to setup a network share from Ubuntu 12.04 to a Windows Server 2008 R2 however no matter what changes are made the share fails to mount due to error(13): permission denied.

    Firewall port 445 has been opened between the two servers which enabled me to ping the servers from each other so it's not something on the firewall blocking the connection.

    The windows server is not part of a domain so I've tried with and without workgroup option. The windows account isn't disabled, I check often to make sure that I haven't locked it. Trying to use a 16 char password with lower/upper alphanumeric. No special characters.

    Windows Advanced Share permissions has Everyone(full/read/write) and the user account(full/read/write) permissions. Windows Folder Security has Everyone(Full/read/write) and the user account (full/read/write). I can access the windows share from my local box using the same username/password as used for the mount commands below. The windows share is located at C:\Share.

    Windows Event viewer is reporting it as Unknown user name or bad password with or without the sec=ntlmv2 or sec=ntlm. Any changes to the sec option still provides a error(13). The user account is an administrator on the server and i've typed and retyped and reset the password from something complex to something simple and still not going through. My local box can connect through the windows share no problem with any version of the password set.

    The windows network connection is considered a public network. Under Network and Sharing Center the Advanced Sharing Settings->Home/Work and Public - Public Folder sharing have been set to turned On. Password protected sharing-> turned on since I'm trying to use an admin account local to the server.

    The /mnt/share directory has been created and has been tested with rw-rw-r--,rwxrwxrwx,rw-rw-rw-,rwxrwxrw- permissions just in case it had something to do on the linux side.

    I tried both user= and username= with all of the commands listed below. Also made sure not to use any extra white spaces unless needed. No quotation marks are used anywhere in the commands, I've read some people were doing username='user'

    Following received a Error:13(Permission denied)

    sudo mount -t cifs //{ipaddress}/share /mnt/share -o user={user},password={pass}
    sudo mount -t cifs //{ipaddress}/share /mnt/share -o user={user},password={pass},nosuid
    sudo mount -t cifs //{ipaddress}/share /mnt/share -o user={user},password={pass},sec=ntlm
    sudo mount -t cifs //{ipaddress}/share /mnt/share -o user={user},password={pass},sec=ntlmssp
    sudo mount -t cifs //{ipaddress}/share /mnt/share -o user={user},password={pass},workgroup=workgroup,file_mode=0777,dir_mode=0777,iocharset=utf8
    sudo mount -t cifs //{ipaddress}/share /mnt/share -o user={user},password={pass},workgroup=workgroup,file_mode=0777,dir_mode=0777,iocharset=utf8,sec=ntlm
    
    sudo mount.cifs //{ipaddress}/share /mnt/share -o user={user},password={pass},port=445
    sudo mount.cifs //{ipaddress}/share /mnt/share -o user={user},password={pass},port=445,nosuid
    sudo mount.cifs //{ipaddress}/share /mnt/share -o user={user},password={pass},port=445,sec=ntlm
    sudo mount.cifs //{ipaddress}/share /mnt/share -o user={user},password={pass},port=445,sec=ntlmssp
    sudo mount.cifs //{ipaddress}/share /mnt/share -o user={user},password={pass},port=445,workgroup=workgroup,file_mode=0777,dir_mode=0777,iocharset=utf8
    sudo mount.cifs //{ipaddress}/share /mnt/share -o user={user},password={pass},port=445,workgroup=workgroup,file_mode=0777,dir_mode=0777,iocharset=utf8,sec=ntlm
    

    Following received a Error:22(Invalid Argument)

    sudo mount.cifs //{ipaddress}/share /mnt/share -o user={user},password={pass},port=445,sec=ntlmv2
    sudo mount -t cifs //{ipaddress}/share /mnt/share -o user={user},password={pass},sec=ntlmv2
    sudo mount -t cifs //{ipaddress}/share /mnt/share -o sec=ntlmv2,user={user},password={pass},port=445
    

    I also downloaded and tried the outdated SMBFS which also produced a Error:13

    Any thoughts?

    • Admin
      Admin about 10 years
      What about if you pass the domain parameter? mount -t cifs //{hostname}/{sharename} /mnt/share -o username={username},password={password},domain={hostname}
    • E.nunez
      E.nunez about 10 years
      The domain also gave the permissions error. I reset the password again to 'Testpass01' for being quite a bit shorter than all the other passwords used and was able to connect.
  • Admin
    Admin about 10 years
    That´s a weird one. It has been time since samba/cifs share allow more than 14 characters on password field - lists.samba.org/archive/linux-cifs-client/2007-June/002026.h‌​tml
  • roaima
    roaima over 2 years
    {user} is supposed to be replaced with your username