0

I want to access a windows share from my vbox ubuntu machine (I have all proxies set up correctly).

The problem is that I get a permission denied error with no extra reasons when trying to mount via :

 mount -t cifs "//server/share" /windowsshare/myshare -o username=<activediruname>,password=<pass>,domain=<ADdomain>,ro

I get this error:

mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

I have an $ character inside the password but I don't think that is the problem because I have also tried setting the PASSWD env var and removing the password= option and still permission denied error.

Any ideas, clues or information about how to debug the information further will be greatly appreciated .

7
  • The $ might trigger shell's variable expansion -- in both cases (command line option, PASSWD env var). Have you tried to put single quotes around the -o parameter: ... -o 'username=.....'?
    – mpy
    Mar 29, 2015 at 9:54
  • @DavidPostill: This problem IMHO does not sound corporate network specific, indeed I think it might as well show up in the home network. So, removing both word 'corporate' will make the question perfectly OT?! What do you think?
    – mpy
    Mar 29, 2015 at 10:01
  • @mpy agreed. I edited the question and retracted my vote ;)
    – DavidPostill
    Mar 29, 2015 at 10:03
  • I added single quotes around the options string and sec=krb5,ver=1 , to the command line option and now I get mount error(2): No such file or directory . I don't know if this is before or after the password verification or after (is it progress?) Mar 30, 2015 at 11:33
  • I'd say it is progress as your credentials are accepted by the server now. Regarding the new error, pls check unix.stackexchange.com/a/154465 -- and try (notice the s) vers=3.0.
    – mpy
    Mar 30, 2015 at 16:16

1 Answer 1

0

In general, if you use an unescape or not-single-quoted dollar sign on the command line, it is subject to parameter expansion, i.e. the parameter value is substituted for the parameter name. Let's assume your password is foo$bar. I use echo to display to actual executed command line:

$ echo mount -t cifs ... -o username=user1,password=foo$bar,domain=WIN,ro
mount -t cifs ../../ -o username=user1,password=foo,domain=WIN,ro
$ PASSWD=foo$bar
$ echo $PASSWD
foo

You can see the $bar part is replaced by nothing, because in this example there is no bar parameter set. To prevent this, use single-quotes around the $ or the whole term:

$ echo mount -t cifs ... -o 'username=user1,password=foo$bar,domain=WIN,ro'
mount -t cifs ../../ -o username=user1,password=foo$bar,domain=WIN,ro
$ PASSWD='foo$bar'
$ echo $PASSWD
foo$bar

So, the reason for the mount error(13): Permission denied error is, the server rejects your password, because the shell replaced some parts of it.

3
  • A wierd thing is that after I added the sec=krb5 option and got "mount error(2): No such file or directory" . I changed my password to a wrong one and i still got the same "mount error(2): No such file or directory" error .. Mar 31, 2015 at 17:11
  • Have you tested without sec=kbr5 as in your question? In my test it behaved like one thinks, wrong password (also unquoted $ in it, or intentional wrong) gives error(13), right password (with quoted $) worked.
    – mpy
    Mar 31, 2015 at 18:20
  • I will try some more tomorrow (I don't have access to the vm now) . I was also thinking .. since I am using virtualbox (with vagrant ) , I could maybe create a local share without authentification of the network share and pass that to the vim (if it is possible docs.vagrantup.com/v2/synced-folders/smb.html ) . or with guest additions? Mar 31, 2015 at 20:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .