LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-12-2022, 04:14 PM   #1
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,612

Rep: Reputation: 180Reputation: 180
Trouble mounting cifs


This is probably something simple and I'll kick myself later ... I've move a computer that does Samba shares to a different network and IP. Now I can't connect to it. I can ssh, http and POP/SMTP to it, but not samba mount. All I get in my /var/log/messages file is:
Code:
CIFS: Attempting to mount \\24.142.999.99\trashbin
I'm doing:
Code:
mount -t cifs -o username=me,password=mypass,uid=myuser,gid=users,_netdev //24.142.999.99/trashbin /mnt/trash
Where should I look for the problem?
 
Old 09-12-2022, 04:46 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,160

Rep: Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266Reputation: 1266
Hopefully 24.142.999.99 is a made-up address, since it is not a valid IP.

Please check /proc/filesystems. If cifs is not present, you may need to load filesystem support with:

Code:
sudo modprobe cifs
If that was the problem you can add an entry to /etc/modules-load.d/ to automatically load the cifs module at boot.
 
Old 09-12-2022, 06:02 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937
Define what you mean by move to another network.

Do you have a specific hosts allow directive in your smb.conf?
 
Old 09-12-2022, 11:03 PM   #4
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,612

Original Poster
Rep: Reputation: 180Reputation: 180
Quote:
Originally Posted by smallpond View Post
Hopefully 24.142.999.99 is a made-up address, since it is not a valid IP.
Yes, it is fake.
Quote:
Please check /proc/filesystems. If cifs is not present, you may need to load filesystem support with:

Code:
sudo modprobe cifs
If that was the problem you can add an entry to /etc/modules-load.d/ to automatically load the cifs module at boot.
cifs was not present, but this same config worked find before I moved the computer. Nevertheless, I triled the modprobe cifs (and verified it was loaded). It didn't help.
Quote:
Originally Posted by michaelk View Post
Define what you mean by move to another network.
I mean that I had this on my local LAN with IP 192.168.0.15. Then I phyiscally move this computer to another location with a public/static IP. As mentioned, all other ports work.
Quote:
Do you have a specific hosts allow directive in your smb.conf?
I did not, but I added one to smb.conf. No go.

I have ports 139 and 445 configured with iptables. Doing 'telnet localhost 139' (or 445) works. Doing 'telnet FDQN 139' (or IP) does not. Do you suppose the ISP is blocking these ports?

Last edited by mfoley; 09-12-2022 at 11:04 PM.
 
Old 09-12-2022, 11:18 PM   #5
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,767

Rep: Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765
Did you check your "interfaces" setting in smb.conf? There you can set it to only listen on certain interfaces, certain subnets, on a certain address. If those are set and you change network without re-setting it to match you would expect this behavior.
 
Old 09-12-2022, 11:19 PM   #6
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,612

Original Poster
Rep: Reputation: 180Reputation: 180
Later ... Yes! The ISP, Spectrum, does block ports 139 and 445: https://www.spectrum.net/support/internet/blocked-ports. I've added 'smb ports = 9999' (also fake) to smb.conf and changed my mount to:
Code:
mount -t cifs -o username=me,password=mypass,uid=myuser,gid=users,port=9999,_netdev //24.142.999.99/trashbin /mnt/trash
That worked! I could mount this share!!

But that's Linux. Now I have to figure out how to mount that with Windows 10 ...
 
Old 09-13-2022, 03:56 AM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937
IMHO it is a very bad idea to use SMB directly over the internet which is why ISPs block those ports. smb3 is better but is not 100% secure either IMHO. Better to use VPN. Even though you change ports the script kiddies will eventually find you.

Last edited by michaelk; 09-13-2022 at 03:58 AM.
 
2 members found this post helpful.
Old 09-13-2022, 11:56 AM   #8
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,612

Original Poster
Rep: Reputation: 180Reputation: 180
Quote:
Originally Posted by michaelk View Post
IMHO it is a very bad idea to use SMB directly over the internet which is why ISPs block those ports. smb3 is better but is not 100% secure either IMHO. Better to use VPN. Even though you change ports the script kiddies will eventually find you.
I agree, that's why I am going to try to set up using NFS for now. If I can mount the NFS exports locally, I can then Samba/cifs share those NFS mounts on my local linux host for mapping by my local Windows computer. I've done this before.

Thus far I have configured the NFS export of the remote computer:
Code:
/tmp/trash   184.57.999.99(rw,no_root_squash,acl)
and opened port 2049 on the firewall.

I am running nfsd, rpc.mountd and rpc.statd. I can now mount via nfs:
Code:
# mount -t nfs -o noauto,nfsvers=4,rw,hard,intr remotehost.com:/tmp/trash /mnt/trash
Note that I needed nfsvers=4. Using nfsvers=3 I got the error:
Code:
mount.nfs: rpc.statd is not running but is required for remote locking.
mount.nfs: Either use '-o nolock' to keep locks local, or start statd.
even though rpc.statd was running.

I've also successfully Samba-shared this NFS mount and mapped it from my local Windows 10. All seems to work, but much slower than when this was all local.

Next I will try using a nfs4 tunnel of ssh. Here's on link, but I haven't tried it yet. https://web.archive.org/web/20130526...-nfs4-over-ssh

Last edited by mfoley; 09-13-2022 at 12:25 PM.
 
Old 09-13-2022, 12:29 PM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937
I am not an expert in nfs security but you probably should be using version 4 with kerberos authentication over the internet. I suggest using a VPN like wireguard or OpenVPN. I thought about suggesting using sshfs -> samba share but I do not think that would be reliable.
 
Old 09-13-2022, 12:30 PM   #10
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,767

Rep: Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765
There is NO kind of drive sharing that is very secure over wild network (the internet as one example). CIFS and NFS are fine in secure environments. Over secured VPN they suck, can be problematic, and are still less than secure. SSHFS is my choice, and only brought up on-demand for short periods. I find better ways to operate than drive mounts wherever possible.

I figure we will invent a perfectly secure drive mount system one day, and two days later some hacker will figure out how to break it.
 
Old 09-14-2022, 10:06 PM   #11
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,612

Original Poster
Rep: Reputation: 180Reputation: 180
michaelk and wpeckham: Thanks for your feedback. Background: For 20 years I've had my main "work" computer in my home office with my own mail server on a dynamic IP. I've logged into that from a Linux workstation, also at home, running KDE and that workstation would mount some of the folders via cifs for access by Dolphin, Kate, etc. This workstation also runs a Windows 10 Virtual Machine, and the cifs mounts were useful for mapping these same folders for access by Windows. Originally, that was all on an internal 192.168.0.0/24 network.

Lately, services like gmail have been cracking down and not allowing mail from dynamic IPs. Therefore I had the choice of getting a static IP for my home office, or moving the main "work" server to an office location with a static business IP. I chose the latter ... for now.

So far things are working OK with the NFS mount to my linux workstation and cifs mounts from Windows to the linux workstation. I am using nfs v4. I'll add tunneling when I get a chance. I have restricted the nfs export to just my home IP address.

More feedback is welcome, but I think since my original question has been answered I should probably mark this as solved.
 
  


Reply

Tags
mount.cifs, samba



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cifs "mount error 13 = Permission denied" CIFS SUCKS humbletech99 Linux - Networking 45 04-06-2020 05:31 AM
manual mount cifs works but srcipt mount cifs has mount error (13): Permission denied CADIT Linux - Newbie 6 11-20-2009 02:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration