4

I'm running Lubuntu 16.04.1 on my laptop. At work, I plug it into the wall with an Ethernet cable. This provides Internet access and also lets me access a directory of files (perhaps a share, or is it a server, or both?) called cchfs (smb://cchfs), which is used as a mapped network drive on the Windows machines here. I can see the files in cchfs by opening PCManFM, choosing Go → Network, and then opening the icons "Windows Network", "NPI_HRRP", "CCHFS" (here I'm prompted for my login details), "Root".

This all works fine, but I'd like to be able to interact with these files in zsh instead of just PCManFM, and I can't figure out how to do that. I think the first step, after creating a mount point with sudo mkdir /media/cchfs, is to mount the filesystem like so:

sudo mount -t cifs -o user=NPI_HRRP/KArfer smb://cchfs /media/cchfs

but this produces the error Mounting cifs URL not implemented yet. From this question, which is about this error message, it looks like I need to replace smb://cchfs with //SOMETHING/cchfs or //cchfs/SOMETHING. But I don't know which, nor what the SOMETHING should be. I've tried a lot of guesses but only gotten pretty cryptic error messages.

Edit 1: Following these instructions on a Windows machine at the office, I got:

 C:\Users\karfer>net use
 New connections will be remembered.


 Status       Local     Remote                    Network

 -------------------------------------------------------------------------------
 OK           X:        \\cchfs\root              Microsoft Windows Network
 The command completed successfully.


 C:\Users\karfer>nslookup cchfs
 Server:  nsmcoint.medctr.ucla.edu
 Address:  10.2.14.10

 Name:    cchfs.cch.ucla.edu
 Address:  10.48.154.235

and so I tried:

sudo mount -t cifs -o user=NPI_HRRP/KArfer //10.48.154.235/cchfs /media/cchfs

which yields mount error(13): Permission denied (-v just adds mount.cifs kernel mount options: ip=10.48.154.235,unc=\\10.48.154.235\cchfs,user=NPI_HRRP/KArfer,pass=********) and in dmesg:

[ 2734.297317] Status code returned 0xc000006d NT_STATUS_LOGON_FAILURE
[ 2734.297332] CIFS VFS: Send error in SessSetup = -13
[ 2734.297591] CIFS VFS: cifs_mount failed w/return code = -13

I also tried //10.48.154.235/root in place of //10.48.154.235/cchfs, which didn't change anything.

I'm pretty sure I'm typing my password correctly. My password has capital letters and an exclamation point in it. Could that be a problem for mount although it's seemingly not a problem for PCManFM?

Edit 2: It looks like my credentials get accepted if I use KArfer in place of NPI_HRRP/KArfer. (It doesn't seem to make a difference whether or not I pass in domain=NPI_HRRP as well.) But now I get:

mount.cifs kernel mount options: ip=10.48.154.235,unc=\\10.48.154.235\cchfs,user=KArfer,pass=********
Retrying with upper case share name
mount.cifs kernel mount options: ip=10.48.154.235,unc=\\10.48.154.235\CCHFS,user=KArfer,pass=********
mount error(6): No such device or address

Changing cchfs to a few other things doesn't change anything, except that if I use X$ in place of cchfs, I get Permission denied again.

Edit 3: The output of smbclient -W=NPI_HRRP -U=KArfer -L //CCHFS is:

WARNING: The "syslog" option is deprecated
Enter KArfer's password: 
Domain=[NPI_HRRP] OS=[Windows Server 2008 R2 Enterprise 7601 Service Pack 1] Server=[Windows Server 2008 R2 Enterprise 6.1]

        Sharename       Type      Comment
        ---------       ----      -------
        IPC$            IPC       Remote IPC
        Root            Disk      
        X$              Disk      
Domain=[NPI_HRRP] OS=[Windows Server 2008 R2 Enterprise 7601 Service Pack 1] Server=[Windows Server 2008 R2 Enterprise 6.1]

        Server               Comment
        ---------            -------

        Workgroup            Master
        ---------            -------

However, mount -t cifs -o username=NPI_HRRP/KArfer'%hunter2' //CCHFS /mnt, replacing hunter2 with my password, yields mount error(22): Invalid argument (after prompting for my password despite my inclusion of it in the command line). Same thing if I replace CCHFS with 10.48.154.235.

15
  • 1
    @SpasSpasov Great, thanks. I'll try that tomorrow. Sep 14, 2016 at 23:36
  • 1
    Maybe you should use \! and \/. Check this: serverfault.com/questions/309429/…. Or according to: serverfault.com/a/170446/364207 you must use "quotes". Or change / add -sec option: unix.stackexchange.com/a/124696
    – pa4080
    Sep 15, 2016 at 17:58
  • 1
    @SpasSpasov These don't seem to help, at least separately (and there are too many combinations to try with blind guessing). Changing sec does change the error message in some cases: Unknown error 524 for sec=ntlmv2i and Invalid argument for sec=ntlmv2. Sep 15, 2016 at 18:24
  • 3
    I've made a test: Ubuntu 16.04 cifs mount Windows 10 shared folder. First I've tried sudo mount -t cifs -o user=win-user,password=abc123 //192.168.1.110/Win-to-Ubuntu /mnt/test - here it works. After changing of the password to abc!@3 correct command is: sudo mount -t cifs -o user=win-user,password=abc\!\@3 //192.168.1.110/Win-to-Ubuntu /mnt/test. I think you should investigate the type of the server, but at the moment I don't have an idea how.
    – pa4080
    Sep 15, 2016 at 18:50
  • 1
    @SpasSpasov The need to escape ! (at least) has nothing to do with the server. It's just that ! is a metacharacter in the POSIX shell. Both \! and \@ are resolved to the literal characters, so the backslash isn't sent over the wire. Sep 15, 2016 at 19:21

3 Answers 3

1
+50

From the information given, NPI_HRRP is your workgroup, while CCHFS is your server.

First thing in solving samba issues for me is to try with smbclient first. If I have success getting access to the share with it, I map the required information to a mount line.

smbclient -U KArfer -L //CCHFS should give you a list of available shares on CCHFS. Maybe you need smbclient -W=NPI_HRRP -U=KArfer -L //CCHFS if you need to enter the workgroup first.

If this works, a mount line like mount -t cifs -o username=NPI_HRRP/KArfer%ToPsEcReT //CCHFS/x$ /mnt should work as well. If this fails and dmesg shows "Unable to determine destination address.", replace //CCHFS with //10.48.154.235, the IP address of your server.

A line like mount -t cifs -o credentials=~/.smbcredentials //10.48.154.235/x$ /mnt might be better to avoid having your password in your bash history.

Also, you cannot mount the "root" of a samba share. You might be limited to the mount of X$. Or is the share's name really "Root" in your case? This is really confusing.

6
  • See my Edit 3 above. Oct 11, 2016 at 16:44
  • This sounds like an authorization issue. Use a file ~/.smbcredentials, chmod 600, with three lines: username= password= domain= and a mount option credentials=~/.smbcredentials to test.
    – emk2203
    Oct 11, 2016 at 17:08
  • I've tried that, too. See my comments to Elder Geek. Oct 11, 2016 at 18:29
  • I have changed my mount line according to the info you gave. Try smbclient //cchfs/x$ or smbclient //10.48.154.235/x$, followed by ls, to see if you can access the server. If this works, try the equivalent in your mount line (see my edit).
    – emk2203
    Oct 12, 2016 at 6:23
  • I finally got it. The line that did it was sudo mount -t cifs -o credentials=/home/hippo/.smbcredentials //CCHFS/Root /mnt/cchfs. Oct 12, 2016 at 15:30
0

Make sure /mnt/cchfs exists then try this:

 mount -t cifs -o username=youruser,password=yourpassword //10.48.154.235/cchfs /mnt/cchfs
1
  • This form yields the same error messages as the form I tried above. Oct 9, 2016 at 20:30
0

Try the folowing line in /etc/fstab

//10.48.154.235/Root /mnt/cchfs cifs credentials=/home/hippo/.smbcredentials 0 0

This assumes that the IP address, sharename, and contents of your credentials file are all correct. If for some reason the share isn't mounted at boot you can try mounting it at login instead by changing fstab to read

//10.48.154.235/Root /mnt/cchfs cifs noauto,credentials=/home/hippo/.smbcredentials 0 0

and putting the following in /etc/rc.local

mount /mnt/cchfs
exit 0

Sources:

https://wiki.ubuntu.com/MountWindowsSharesPermanently

https://anothersysadmin.wordpress.com/2007/12/17/howto-mount-samba-shares-in-fstab-using-a-credential-file/

4
  • I found a typo in my credentials file and fixed it. However, sudo mount -a with this line now yields Retrying with upper case share name (newline) mount error(6): No such device or address. Oct 11, 2016 at 17:55
  • I suggest that you review your fstab and credentials files for accuracy and insure the server at 10.48.154.235 is up and running.
    – Elder Geek
    Oct 11, 2016 at 18:05
  • It all seems fine to me. The server must be working because I can access it from other computers and from PCManFM on my own. It still seems to have the IP address 10.48.154.235, according to nslookup on a Windows machine. Oct 11, 2016 at 18:28
  • 1
    @ElderGeek: This is why the step with smbclient is so useful. You know that the server is working, the hardware is working and the system itself can connect to a samba share. Only thing left is to fiddle with the mount options. For my workflow, making a /etc/fstab entry comes last. I always try to mount manually at least once, since it is much easier to debug.
    – emk2203
    Oct 11, 2016 at 20:42

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