Mount cifs bad unc ошибка

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?

asked Oct 24, 2014 at 10:22

Black Magic's user avatar

3

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.

answered Oct 24, 2014 at 12:33

rob's user avatar

robrob

2,7932 gold badges21 silver badges31 bronze badges

1

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.

Community's user avatar

answered Feb 11, 2016 at 16:19

Weiliang Zhu's user avatar

2

Ubuntu 18

In this article, we will delve into the details of how to fix the “mount.cifs: bad UNC” error when mounting a remote drive in Ubuntu. This error typically occurs due to incorrect usage of the Universal Naming Convention (UNC) syntax. We will walk you through the steps to correct this issue and successfully mount your remote drive.

To fix the «mount.cifs: bad UNC» error when mounting a remote drive in Ubuntu, you need to correct the UNC syntax in your fstab entry, ensure the server name is resolvable, and use the correct mounting command with the appropriate options.

  1. Understanding the “mount.cifs: bad UNC” Error
  2. Steps to Fix the Error
    • 1. Correct the UNC Syntax
    • 2. Resolve the Server Name
    • 3. Use the Correct Mounting Command
  3. Conclusion

Understanding the “mount.cifs: bad UNC” Error

Before we dive into the solution, it’s important to understand what the error means. The “mount.cifs: bad UNC” error message is usually a result of incorrect UNC syntax. The correct UNC syntax is //server/share. This means you should have double slashes before the server name and a single slash between the server name and the share name.

Steps to Fix the Error

1. Correct the UNC Syntax

The first step is to correct the UNC syntax in your fstab entry. The fstab file, located in /etc/fstab, is used to define how disk partitions, various other block devices, or remote filesystems should be mounted into the filesystem.

For instance, if your current entry looks like this: /servername//data.xxx.xxx.ac.uk/, you need to correct it to: //servername/data.xxx.xxx.ac.uk/.

2. Resolve the Server Name

Next, ensure that the server name is resolvable. This means that your system should be able to translate the server name into an IP address. You can check this by using the host command followed by the server name. For example, host servername. If the server name is resolvable, the command will return the corresponding IP address.

3. Use the Correct Mounting Command

Finally, instead of manually running sudo mount -a, use the mount command with the appropriate options. Here is an example:

sudo mount -t cifs //servername/data.xxx.xxx.ac.uk/ /media/windowsshare -o user=myuserid,password=mypassword,iocharset=utf8,sec=ntlm

Let’s break down this command:

  • mount is the command to mount filesystems.
  • -t cifs specifies the type of the filesystem. CIFS stands for Common Internet File System, a protocol that allows sharing of files and printers with Microsoft Windows systems.
  • //servername/data.xxx.xxx.ac.uk/ is the UNC path to the remote share.
  • /media/windowsshare is the local directory where the remote filesystem will be mounted.
  • -o is used to specify several comma-separated options. In this case, we have:
    • user=myuserid,password=mypassword: Replace myuserid and mypassword with your actual credentials.
    • iocharset=utf8: This option specifies the character set to use for file names.
    • sec=ntlm: This option specifies the security mode. NTLM is a Microsoft authentication protocol.

Conclusion

Fixing the “mount.cifs: bad UNC” error when mounting a remote drive in Ubuntu is a straightforward process once you understand the UNC syntax and the correct mounting command. By following the steps outlined in this article, you should be able to successfully mount your remote drive and avoid this error in the future.

The fstab file is used to define how disk partitions, various other block devices, or remote filesystems should be mounted into the filesystem.

To correct the UNC syntax, you need to ensure that you have double slashes before the server name and a single slash between the server name and the share name. For example, change /servername//data.xxx.xxx.ac.uk/ to //servername/data.xxx.xxx.ac.uk/.

You can check if the server name is resolvable by using the host command followed by the server name. For example, host servername. If the server name is resolvable, the command will return the corresponding IP address.

The mount command is used to mount filesystems, including remote filesystems. It allows you to access and use files stored on external drives or network shares.

The -t cifs option specifies the type of the filesystem to be mounted. In this case, it indicates that the filesystem is a Common Internet File System (CIFS), which is used for sharing files and printers with Microsoft Windows systems.

The -o option is used to specify several comma-separated options for the mount command. It allows you to provide additional parameters such as the user credentials, character set, and security mode for the mount operation.

You can specify your user credentials using the user=myuserid,password=mypassword option in the -o parameter of the mount command. Replace myuserid and mypassword with your actual credentials.

The iocharset=utf8 option specifies the character set to use for file names. In this case, it sets the character set to UTF-8, which is a widely supported character encoding that can handle a wide range of characters and symbols.

The sec=ntlm option specifies the security mode to use for the mount operation. NTLM is a Microsoft authentication protocol that is commonly used for accessing Windows-based network shares.

Following these steps should fix the error and allow you to successfully mount your remote drive. However, if the error persists, there may be other underlying issues that need to be addressed.

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?

asked Oct 24, 2014 at 10:22

Black Magic's user avatar

3

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.

answered Oct 24, 2014 at 12:33

rob's user avatar

robrob

2,7932 gold badges21 silver badges31 bronze badges

1

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.

Community's user avatar

answered Feb 11, 2016 at 16:19

Weiliang Zhu's user avatar

2

I am trying to access a remote drive from my PC using fstab but I get an error:

$ sudo mount -a
mount.cifs: bad UNC (/servername//data.xxx.xxx.ac.uk/)

This is how my fstab looks:

/servername//data.xxx.xxx.ac.uk/ /media/windowsshare cifs iud=myuserid,password=mypassword,iocharset=utf8,sec=ntlm  0  0

How can I fix it?

Zanna's user avatar

Zanna

69.3k56 gold badges217 silver badges327 bronze badges

asked Feb 3, 2017 at 23:12

Ahmet Ozturk's user avatar

UNC syntax is //server/share, not /server//share/. Note double slash before the server name, one slash between the server name and the share name.

answered Feb 4, 2017 at 0:15

AlexP's user avatar

AlexPAlexP

10k1 gold badge33 silver badges40 bronze badges

3

You have to use double slash for mounting command. Like this

sudo mount -t cifs //xxx.xxx.xxx.xxx/Folder_1/ /media/usb/ -o user=admin

answered Jun 5, 2017 at 3:45

High Performance Rangsiman's user avatar

You must log in to answer this question.

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

.

  • Home
  • Forum
  • The Ubuntu Forum Community
  • Ubuntu Official Flavours Support
  • General Help
  • [SOLVED] mount CIFS — bad UNC

  1. mount CIFS — bad UNC

    I recently migrated from ubuntu 12 to 14 and seem to have lost the ability to mount my Windows file share (drive S: ) I’m getting a bad UNC error. Tried both command line and fstab (original from when I ran 12.04).

    root@nm:/# mount -t cifs dpm-2.xxxxx.org:S /mnt/dpm2 -o username=xxxxx,password=xxxxxmount.cifs: bad UNC (dpm-2.xxxxx.org:S)

    I know it resolves so DNS is OK:
    root@nm:/# ping dpm-2.xxxxx.org
    PING dpm-2.xxxxx.org (101.216.211.42) 56(84) bytes of data.
    64 bytes from dpm-2.xxxxx.org (101.216.211.42): icmp_seq=1 ttl=128 time=0.449 ms

    Here is the original fstab entry:
    dpm-2.xxxxx.org:S /mnt/dpm2 cifs usernam=xxxxx,password=xxxxx 0 0
    root@nm:/# mount -a
    mount.cifs: bad UNC (dpm-2.xxxxx.org:S)

    Am I misformatting the UNC?


  2. Re: mount CIFS — bad UNC

    Format of the mount command:
    mount -t cifs dpm-2.xxxxx.org:S

    should have read:
    mount -t cifs dpm-2.xxxxx.org/S


Tags for this Thread

Bookmarks

Bookmarks


Posting Permissions

Понравилась статья? Поделить с друзьями:
  • Mount blade 2 bannerlord ошибка при загрузке
  • Mount blade 2 bannerlord выходит ошибка
  • Mount and blade ошибка rgl error
  • Mount and blade огнем и мечом ошибка
  • Mount and blade with fire and sword ошибка