4

I am trying to mount a folder from my embedded Linux system to a windows 7 computer. I keep getting Permission Denied when I try using a credentials file. When I do it from command line as root it works. I type in

mount -t cifs //[IPAddress]/[Folder Path] /home/[user]/ShareFolder -o username=[Username] -o uid=[user]

when I do it from the fstab folder it works.

//[IPAdress]/[Folder Path] /home/[user]/ShareFolder cifs user,username=[Username],password=[Password],sec=ntlm,uid=[user],noauto 0 0

but if I switch to using a credentials file it does not work

//[IPAddress]/[Folder Path] /home/[user]/ShareFolder cifs user,credentials=/home/[user]/smbcredentials,user,sec=ntlm,uid=[user],noauto 0 0

the credentials file is

username=[username]

password=[password]

I have tried it with domain, and that didn't work. I turned on verbose to see what the difference was between the working fstab and the non-working fstab with credentials file.

working:

mount.cifs kernel mount options: ip=[IPAddress],unc=\[IPAddress]..., sec=ntlm,noauto,uid=500,gid=500,user=[WINDOWS USERNAME],prefixpath=[path to folder],pass=*

non-working:

mount.cifs kernel mount options: ip=[IPAddress],unc=\[IPAddress]..., sec=ntlm,noauto,uid=500,gid=500,user=[LINUX USERNAME],prefixpath=[path to folder],pass=*

the difference is that the working one uses the windows username as user and the non-working one uses the linux username. I'm not sure how to fix this.

  • credential file needs separate lines for username and password, it's not clear if that's the case here. Also you have the "user" option twice in the fstab (not that that should matter). – wurtel Sep 18 '14 at 14:09
  • From the mount.cifs man page: user=arg specifies the username to connect as. If this is not given, then the environment variable USER is used. This option can also take the form "user%password" or "workgroup/user" or "workgroup/user%password" to allow the password and workgroup to be specified as part of the username. – eyoung100 Sep 18 '14 at 14:11
  • I'm sorry. In the credentials file the username and password are on two separate lines. I edited the post to reflect that. – LJSkow Sep 18 '14 at 14:12
  • I'm not sure why I need to specify user=arg when I put the username in the credentials file. – LJSkow Sep 18 '14 at 14:14
  • You are right that if I modify it to say user=[Windows username] in the fstab it will work. But I need non-root users to mount this, and I thought that the user command allowed that. If I change the user=[Windows Username], then I need to add users to allow non-roots to mount. But also isn't the point of the credentials is to have the username and password in them. Non-root users will not be able to alter the fstab but they can alter the credentials file. So what am I doing wrong with my credentials file that it doesn't work correctly? – LJSkow Sep 18 '14 at 18:27
4

I had a similar issue. For me installing cifs-utils fixed the issue.

  • The lack of the cifs-utils package was preventing the credentials=XXX from working for me. That's kind of an important detail to know. – pdwalker Feb 12 '18 at 8:04
  • Same here. Without it, you get a cryptic error from mount that "wrong fs type, bad option, bad superblock on <share>, missing codepage or helper program or other error" along with a suggestion to check dmesg, which shows no username was specified. sudo apt-get install cifs-utils fixed for me as well. – aggieNick02 Mar 16 '18 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.