10

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?

Black Magic
  • 203
  • 1
  • 2
  • 6

2 Answers2

19

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.

rob
  • 2,803
  • 2
  • 21
  • 31
  • 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 09 '17 at 21:29
2

It works following way ,too

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

By wrapping in single quotes, you can copy-paste the url directly without slash (/,) modifications.

  • 4
    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
  • 4
    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