mount a CIFS share - permission denied

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

mount a CIFS share - permission denied

Mikhail Ramendik
Hello,

My wi-fi router can share the contents of a USB device using FTP and
Samba. I am trying to use this. Windows 7 has connected to the device
flawlwssly when I gave it the right username and password.

So I have also put a line into /etc/fstab:

//192.168.1.254/usbuser      /media/share    cifs
auto,uid=misha,gid=users,credentials=/etc/smbpassword 0 0

(all on one ine)

/etc/smbpassword is

user = usbuser
password = the_right_password_that_works_with_windows

and yet, I get an error 13 permission denied. dmesg has:

[12913.915270] Status code returned 0xc000006d NT_STATUS_LOGON_FAILURE
[12913.915275] CIFS VFS: Send error in SessSetup = -13
[12913.915334] CIFS VFS: cifs_mount failed w/return code = -13

How do I get it to mount the share?

Alternatively, can I use something else to mount the share using CIFS?
Something GUI?

I have used curlftpfs for now but I would like to know how to do samba.
--
Yours, Mikhail Ramendik

Unless explicitly stated, all opinions in my mail are my own and do
not reflect the views of any organization

--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mount a CIFS share - permission denied

David C. Rankin
On 06/14/2017 04:04 PM, Mikhail Ramendik wrote:

> Hello,
>
> My wi-fi router can share the contents of a USB device using FTP and
> Samba. I am trying to use this. Windows 7 has connected to the device
> flawlwssly when I gave it the right username and password.
>
> So I have also put a line into /etc/fstab:
>
> //192.168.1.254/usbuser      /media/share    cifs
> auto,uid=misha,gid=users,credentials=/etc/smbpassword 0 0
>
> (all on one ine)
>
> /etc/smbpassword is
>
> user = usbuser
> password = the_right_password_that_works_with_windows
>

Generally the credentials file should be a per-user file that should have 0600
permission and has the format:

username=yourusername
password=yourpassword

you would generally put it somewhere like $HOME/.config/smb/smbcred

If you are the only user, then I guess it doesn't matter.

> and yet, I get an error 13 permission denied. dmesg has:
>
> [12913.915270] Status code returned 0xc000006d NT_STATUS_LOGON_FAILURE
> [12913.915275] CIFS VFS: Send error in SessSetup = -13
> [12913.915334] CIFS VFS: cifs_mount failed w/return code = -13
>
> How do I get it to mount the share?
>

There is a good chance your wifi router only supports NTLMv1 access. If so,
then try adding the option, 'sec=ntlm' to your mount string, e.g.

 # mount.cifs //server/share /mnt/point -o sec=ntlm,...

(you can also use smbclient to test, e.g.
 smbclient -Uusername-Lhost -Acredentialfile)

If your router supports NTLMv2, try adding the option `sec=ntlmssp` to your
normal mount string, e.g.

 # mount.cifs //server/share /mnt/point -o sec=ntlmssp,...

There have been a number of changes in samba's auth mechanism over the past
year or so, and I haven't kept up with all of them. You may want to look at
man smb.conf under the 'lanman auth' section and search on 'ntlm' to see if
there have been any recent additions or changes.

--
David C. Rankin, J.D.,P.E.

--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mount a CIFS share - permission denied

Vojtěch Zeisek-2
Dne čtvrtek 15. června 2017 0:55:58 CEST, David C. Rankin napsal(a):

> On 06/14/2017 04:04 PM, Mikhail Ramendik wrote:
> > My wi-fi router can share the contents of a USB device using FTP and
> > Samba. I am trying to use this. Windows 7 has connected to the device
> > flawlwssly when I gave it the right username and password.
> >
> > So I have also put a line into /etc/fstab:
> >
> > //192.168.1.254/usbuser      /media/share    cifs
> > auto,uid=misha,gid=users,credentials=/etc/smbpassword 0 0
> >
> > (all on one ine)
> >
> > /etc/smbpassword is
> >
> > user = usbuser
> > password = the_right_password_that_works_with_windows
>
> Generally the credentials file should be a per-user file that should have
> 0600 permission and has the format:
>
> username=yourusername
> password=yourpassword
Yes. Not 'user'. There also can be (if relevant) 'domain=XXX'.

> you would generally put it somewhere like $HOME/.config/smb/smbcred
>
> If you are the only user, then I guess it doesn't matter.

It does.

> > and yet, I get an error 13 permission denied. dmesg has:
> >
> > [12913.915270] Status code returned 0xc000006d NT_STATUS_LOGON_FAILURE
> > [12913.915275] CIFS VFS: Send error in SessSetup = -13
> > [12913.915334] CIFS VFS: cifs_mount failed w/return code = -13
> >
> > How do I get it to mount the share?
>
> There is a good chance your wifi router only supports NTLMv1 access. If so,
> then try adding the option, 'sec=ntlm' to your mount string, e.g.
>
>  # mount.cifs //server/share /mnt/point -o sec=ntlm,...
>
> (you can also use smbclient to test, e.g.
>  smbclient -Uusername-Lhost -Acredentialfile)
>
> If your router supports NTLMv2, try adding the option `sec=ntlmssp` to your
> normal mount string, e.g.
>
>  # mount.cifs //server/share /mnt/point -o sec=ntlmssp,...
>
> There have been a number of changes in samba's auth mechanism over the past
> year or so, and I haven't kept up with all of them. You may want to look at
> man smb.conf under the 'lanman auth' section and search on 'ntlm' to see if
> there have been any recent additions or changes.
I think he is missing user mapping. I use:

sudo mount.cifs //win.server/Path /mnt -o credentials=/home/USER/
cifs.txt,uid=USER,gid=users

Normal user does not have any permission to see content of Windows share.
Also, the mounted directory must be readable for user in the credentials file.

--
Vojtěch Zeisek
https://trapa.cz/

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mount a CIFS share - permission denied

Γαβριήλ Παπαδάκης
On Thu, Jun 15, 2017 at 09:11:12AM +0200, Vojtěch Zeisek wrote:
> Dne čtvrtek 15. června 2017 0:55:58 CEST, David C. Rankin napsal(a):
> > On 06/14/2017 04:04 PM, Mikhail Ramendik wrote:
> > > My wi-fi router can share the contents of a USB device using FTP and
> > > Samba. I am trying to use this. Windows 7 has connected to the device
> > > flawlwssly when I gave it the right username and password.


Somewhat unrelated to the above permission issue:

I seem to recall a recently exposed Samba vulnerability, which seems to come
into effect in every Internet-facing Samba server. Maybe your Wi-fi router is
directly connected (ie. it is also a modem). I would also suspect it isn't
regularly updated. If that is the case, maybe you should reconsider opening a
samba share on your router, or, at least, try to employ a workaround:

https://www.samba.org/samba/security/CVE-2017-7494.html


--
 /"\
 \ /    ASCII RIBBON CAMPAIGN
 X     AGAINST HTML EMAIL
 / \    AND POSTINGS

--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Loading...