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
.
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 amount
line.smbclient -U KArfer -L //CCHFS
should give you a list of available shares on CCHFS. Maybe you needsmbclient -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 anddmesg
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.
Make sure /mnt/cchfs exists then try this:
Try the folowing line in /etc/fstab
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
and putting the following in /etc/rc.local
Sources:
https://wiki.ubuntu.com/MountWindowsSharesPermanently
https://anothersysadmin.wordpress.com/2007/12/17/howto-mount-samba-shares-in-fstab-using-a-credential-file/