5

I am trying to mount a windows share using this command:

sudo mount -t cifs -o username=USERNAME,password=PASSWORD \\192.168.2.12\TestShare mnt/

But it is giving me this error:

mount.cifs: bad UNC (\192.168.2.12TestShare)

I have also tried these commands:

sudo mount -t cifs -o username=USERNAME,password=PASSWORD \\192.168.2.12\\TestShare mnt/
sudo mount -t cifs -o username=USERNAME,password=PASSWORD \\192.168.2.12:\TestShare mnt/

But they all give me the same error. The file is shared and the name and password are correct. I have also installed cifsutils.

Does anyone know what I am doing wrong? Does it have something to do with the WORKGROUP?

  • 1
    try //192.168.2.12/TestShare /mnt/ and if your password or username contains special characters try simplifying them. – rob Oct 24 '14 at 12:22
  • Yes! You are my hero today, I can't beleive it was that simple! Thanks! – Black Magic Oct 24 '14 at 12:28
13

try reversing the slashes and pointing to the root mnt folder

sudo mount -t cifs -o username=USERNAME,password=PASSWORD //192.168.2.12/TestShare /mnt/ 

if your password or username contains special characters try simplifying them.

  • Upvote. Yes, in the Windows world it should be forward slashes. Plus I see in your answer that you also corrected the double slashes after the IP address. The only double slash should be at the beginning, as you show here. – SDsolar Jan 9 '17 at 21:29
-1

It works following way ,too

    sudo mount -t cifs -o username=USERNAME,password=PASSWORD '\\192.168.2.12\TestShare' /mnt/ 
  • What does this add to the accepted answer. – Steve Robillard Feb 11 '16 at 17:05
  • 2
    To be fair, this Answerer is pointing out that quoting the '\'s prevents their recognition by the shell as special characters so that the CIFS mount handler can actually get that argument in one piece from the command line and that handler CAN understand the slash swapping that is needed to understand path and file names on products from that Redmond, USA based outfit that uses '/' as a command line argument introducer. – SlySven Feb 11 '16 at 20:05
  • 3
    I'd like to suggest that the answer be elaborated upon to indicate what is being illustrated by it. – Kolban Feb 11 '16 at 20:56

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.