8

I'm currently trying to mount a windows shared drive under linux. The machine is using windows 7 and by default it shares all windows drives if you login as an administrator. I've been able to login and list/copy/delete files via my android phone but I'm having a problem with mounting it on a server.

The command I'm trying:
mount -t smbfs -o username=MyUsername //10.0.0.2/$D /mnt/machine_1_d

I think the problem comes from the $ sign in $D. I just can't remember what was the fix for this. I'm sure it was something really simple but I can't find it on the net also.

4
  • I think it should work if you just write the visible name instead of $D.
    – Khaled
    Apr 25, 2012 at 14:44
  • The name of the shared folder is $D (if that's what you meant) :)
    – tftd
    Apr 25, 2012 at 14:46
  • 1
    tftd, You might want to change the name of the question to "How to mount a windows administrative share on linux via samba" for the next guy to find it.
    – dc5553
    Apr 25, 2012 at 14:51
  • 1
    Don't admin shares (for drive letters) have the dollar after the letter? e.g. D$ ... Just seen your comment on another answer - perhaps you should state yours are a different way around ?
    – Smock
    Nov 13, 2019 at 12:24

4 Answers 4

8

tftd,

try escaping the $ character with a \

mount -t smbfs -o username=MyUsername //10.0.0.2/D\$ /mnt/machine_1_d

dc

2
  • Also it appears you can do it like this mount -t smbfs -o username=MyUsername "//10.0.0.2/$D" /mnt/machine_1_d. This also appears to be working properly. Thanks!
    – tftd
    Apr 25, 2012 at 14:57
  • 1
    @tftd I assume you meant '//10.0.0.2/$D' (with single quotes). Otherwise bash would resolve $D to an empty string. In other words, "//10.0.0.2/$D" would resolve to "//10.0.0.2/", unless you happened to have an environment variable called D.
    – Hubro
    Jun 15, 2018 at 2:17
5

Administrative shares in Windows are named with the volume letter first, then the '$' symbol, not the other way around.

C: --> C$

D: --> D$

sudo mount -t smbfs -o username=graeme,domain=example //server.example.com/C$ /mnt/bla
1
  • 1
    Yes that's correct. In my case, though, it's the other way around. I don't know why. I guess the admin has done some custom settings or something...
    – tftd
    Apr 26, 2012 at 14:05
4

My issue was related to: "mount error(13): Permission denied Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)" For me the solution was adding key to regedit in Window. Below is my answer in other topic: https://serverfault.com/a/619963/237340

2
  • 1
    This was also my issue. I was so close to getting to my laptop Windows share from servers at work. Another day.... Nov 21, 2014 at 19:49
  • Can set via PowerShell: Set-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\ -Name LocalAccountTokenFilterPolicy -Value 1
    – Greg Bray
    Oct 28, 2017 at 20:22
0

I would add a line for that purpose to /etc/fstab file:

//10.0.0.2/d$/ /mnt/documents cifs noserverino,rw,iocharset=utf8,password=xxxxxxxxxx,username=user_with_administrative_rights,domain=my_windows_domain 0 0

After saving changes to this file, mount the file system by means of the command mount -a.

In this case the option rw allows the directory to be read-write, otherwise it should have the option ro.

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.