How To - Simple File Sharing in Mint

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
PcMojo

Re: How To - Simple File Sharing in Mint

Post by PcMojo »

I went through that checklist yesterday, I went ahead and double checked everything but still have the same problem. Part of the sharing problem might be that as soon as I finished the mint share setups I went to the Vista pc and started the process of enabling client print and file sharing. Maybe Ms and Linux are fighting for control of the network! Now I can access Vista's public folder from Mint, but I still can't get past the logon from Vista to Mint. All I wanted was a way to share files between pc's, and I have that now so I'll probably just undo the Mint changes and use the Vista share. Thanks for all of your help!
Cerule

Re: How To - Simple File Sharing in Mint

Post by Cerule »

I found these instructions very helpful. It's about how to mount a remote SSH folder using SSHFS. Simple, fast and efficient. http://howto.blbosti.com/2010/09/mount- ... d-and-gui/
altair4
Level 20
Level 20
Posts: 11419
Joined: Tue Feb 03, 2009 10:27 am

Re: How To - Simple File Sharing in Mint

Post by altair4 »

Cerule wrote:I found these instructions very helpful. It's about how to mount a remote SSH folder using SSHFS. Simple, fast and efficient. http://howto.blbosti.com/2010/09/mount- ... d-and-gui/
And you would post that comment in a HowTo about Samba because:

** You didn't know this was a HowTo?
** You wanted to make enemies quickly?
** You wanted to increase your post count?

As far as the last one is concerned I can tell you that increasing your post count has no rewards. I was under the impression that after a certain number of posts I was eligible to win one of these: http://www.linuxmint.com/store_mintbox.php

Sadly, that was not the case.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
ostracized

Re: How To - Simple File Sharing in Mint

Post by ostracized »

Thanks for the guide. A few suggestions and questions:

Suggestions:

1. I recommend start off the guide with instructions on installing Samba before proceeding, considering the sambaless 18 install.
I think I read somewhere that Clem removed Samba in 18 because of the increased startup time. I'd be curious on a "this session only" share guide versus perpetually sharing folders and having to wait on the network to resolve netbios/wins names on every reboot.

2. I would include a section on how to disable printer sharing. Considering the recent IoT hack yesterday I really think it's best practice to disable devices that don't need to belong on the network, even if they're behind the router (because foolish people turn on UPnP and various other dumb things.) I'm seeing this is fairly straightforward but haven't tested this yet as I'm waiting for a gigabit switch for my own testing:

In the [global] section of /etc/samba/smb.conf, write the following:

Code: Select all

load printers = no
printing = bsd
printcap name = /dev/null
disable spoolss = yes
Additionally I'm hoping this works because the syslog is being spammed again by the cups scheduler and even more often by colord. It *might* be gufw rules but colord goes absolutely nuts in the syslog when it can't find/connect to a previously-stored embedded color profile for your printer/scanner/monitor/other device.

Questions:

1. Back on windows I remember having to manually enable jumbo frames on the network adapters of both machines to transfer very large files otherwise the connection would routinely drop. This was not a default setting on most adapters. Do you know anything about this or are we pretty much at the mercy of whatever network driver is available? And yeah I already saw your guide on setting up a temp local http python server.

2. In your troubleshooting guides you often recommend disabling ufw outright. However, I'm more interested in knowing the exact firewall rule for samba to function. In gufw's report, I'm seeing 2 tcp ports for smbd, 2 udp ports for nmdb, and 2 udp ports for avahi-daemon. But, you don't need to worry about any of that if "allow incoming connections" is selected in gufw because these are local devices right? I seem to recall that "file and printer sharing" was always an exception in the default windows firewall so this never needed tweaking...

3. I'd actually prefer none of my other devices to know I'm sharing anything anyway because I'm used to the advanced sharing in windows by manually typing \\[local IP]\[hiddenShare]$ of the sharing box versus browsing the list of "discoverable devices" in the network pane. Honestly I think that's the best way to do it because no one else can see your device on the network and you need to navigate to the exact share name to see it. This guide is still somewhat relevant for that, right? I'm seeing a commented setting in samba.conf saying wins support = no -- think it's a good idea to uncomment that since we're talking about mint to mint sharing?

4. Also dumb question maybe, but on mint 18, it's probably a good idea to install the samba-recommended dependencies on both machines right?

5. Finally do you know off the top of your head if samba connections are indeed encrypted? I had thought this varied from platform to platform but again, I'm more interested in "less visible" network traffic, even if everything's local. If you don't know, w/e maybe I'll spend another weekend on setting up SFTP or file transfers over ssh.

-thanks for reading.
ostracized

Re: How To - Simple File Sharing in Mint

Post by ostracized »

Ok boys, I got some results back after some testing.

1. Don't rely on restarting smbd and nmbd after modifying the .conf file and expecting everything to refresh nicely. I found that a full system reboot on both machines is needed (aka, not a log out/in) to get proper sharing views refreshed in order after a change to the config.

2. Firewall rules. For those of you with custom rules: client needs to allow server (tcp 139, 445) and bcast address (udp 137-138) on the network. (The avahi-daemon might use 2 other udp ports so be sure to check.) The bcast address isn't needed if you want to access shares directly via IP (versus the resolved netBIOS name) -- I found this by accident but was happy about it because see #3 below. (The address to access the shares in caja is simply: smb://[server IP].) Server needs to allow client address and nothing else. For the 98% of you without custom rules, the shares should work (provided gufw is disabled or is allowing incoming connections) -- no modification to ufw is necessary.

3. Disabling printer sharing. I'm happy to report that the code in my previous post works and the syslogs are no longer spammed by constant messages from the cups scheduler and colord. However, enabling the code on the server kills the list of netBIOS names of the devices in your "browse network" view. Here's when you can access devices (and their list of shares) directly by their network IP as explained in #2 above. If you want the netBIOS names back, then don't add the code to the server's config (and suffer the consequences of a spammed syslog on the server side.)

4. Encryption. I did some more research on this and came up with various results. Apparently the default option is "auto" but I haven't found if "auto" == "preferred" and if both machines would indeed use encrypted connections if both are on auto. Thankfully there is an option to force it: smb encrypt = mandatory (again in the [global] section), however using this on the server side gave me the following very, very weird error when setting up any usershare: 'net usershare' returned error 255: net usershare add: cannot convert name "Everyone" to a SID. Access denied. So, I scrapped this option on the server and the client seems fine with it enabled. (I assume through logic here that a "mandatory" encrypted connection would not be made if the server wouldn't allow it -- if not, this is a horrible bug. Really needs to be tested with tcpdump.) It's worth noting here that a mandatory connection should really be made in your setup because various security issues in the recent past have recommended you have this setting enabled as a "workaround for the bug now." P.S. I also found out that connections to cups are not encrypted by default. This really makes the case to disable printers in #3 or set cups encrypt = auto (Default: "no") for at least a minimal TLS handshake to printers (and available printer drivers) on the network. Bad!

5. Transfer speed and folder views. Some momentary drops from hdd ext4 to ssd ext4 (both fde) but hdd ext4 to hdd ntfs (both fde) was solid at ~60MB/s sustained on a 5GB file. So doing a dumb calculation that's about 48% of theoretical on a gigabit connection with the layered encryption overhead, which is pretty good. CPU utilization wasn't bad at all either. Shares are still listed (but not accessible) to the client if the shared folders are moved to the trash and also if the trash is emptied (lol.) Manually f5 refreshing either the list of shares to mount or the network names occasionally hangs caja to the point where you need to force quit network or windows shares -- I can't reproduce the issue but it seems to happen after a reboot and a first view in the network folder -- I'd recommend not manually refreshing in the "Browse Network" view. If you force quit network, the "file operations" transfer speed box will stay blank for the remaining login session (but will still transfer normally.)
ostracized

Re: How To - Simple File Sharing in Mint

Post by ostracized »

A small update on this, sharing (transferring files) from Mint to Lubuntu with identical settings also had positive results on my end. I installed Lubuntu on my netbook some time ago that only has a 100Mbps ethernet port (and wireless-N) but still produces a consistent 10MB/s share over a local ethernet switch. Trying to play the "wifi file-sharing through the modem/router" game produces significantly less speeds. There's no native share utility on Lubuntu so I just used the old system-config-samba gui, which is actually quite nice as it gives you the option to make hidden shares (note that you need to setup smbpasswd first before the user list in the app is populated.) 10MB/s sustained is still better than any usb 2.0 drive I've used, and probably still better than external drives that use usb 2.0...I've always used e-sata external drives that get into a more respectable range of 60-90MB/s and was honestly kinda surprised e-sata wasn't adopted more frequently back in the day.
laurenaria10

Re: How To - Simple File Sharing in Mint

Post by laurenaria10 »

wow, this is a very awesome file sharing tool i like it alot.
rambo919
Level 5
Level 5
Posts: 675
Joined: Wed May 22, 2013 3:11 pm

Re: How To - Simple File Sharing in Mint

Post by rambo919 »

system-config-samba is outdated and should be deprecated, also it might be wise to update the tutorial since mint19 samba is different to mint16 samba mostly not for the better because of win10 issues.
deeaycee
Level 1
Level 1
Posts: 6
Joined: Tue Feb 22, 2011 7:57 pm

Re: How To - Simple File Sharing in Mint

Post by deeaycee »

altair4
if you're still around, THANK YOU.
I've been using linux for probably 15 years. samba is the devil and file sharing was always too complicated for me to figure out.
I've searched 50 times for answers. I always ended up down some rabbit hole, frustrated and giving up.
i don't know how or why i came across your thread, but I did today. within a minute of reading, I knew your how-to was different, so I tried. It works.
i had to sub

Code: Select all

sudo systemctl restart smbd
instead of

Code: Select all

sudo service smbd restart
I'M FREAKING THRILLED!
THANK YOU!

i'm on linux mint 20.1
lesagephilippe
Level 1
Level 1
Posts: 2
Joined: Sat Apr 10, 2021 12:50 pm

Re: How To - Simple File Sharing in Mint

Post by lesagephilippe »

Thanks for this explanation. Even 12 years after, it is still applicable. I finally could connect my Linux Mint server to my other Xubuntu servers, for file sharing.
Post Reply

Return to “Tutorials”