Unable to set up Samba networking - need fresh start

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
autumnleaves

Unable to set up Samba networking - need fresh start

Post by autumnleaves »

Several unsuccessful attempts to activate a Samba connection between two Mint 18.2 machines. Seem to be going in circles and getting nowhere. Permissions can't be set, fail to add shares, Operation not permitted.
When open drive as root, shares appear, but Nemo can't handle networks.

Is there a way to wipe the slate clean and start with something that works? Maybe something other than Samba.

Cinnamon 18.2 64 bit
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
coffee412
Level 8
Level 8
Posts: 2271
Joined: Mon Nov 12, 2012 7:38 pm
Location: I dont know
Contact:

Re: Unable to set up Samba networking - need fresh start

Post by coffee412 »

Since your not involving Windows machines here I would totally suggest you use NFS instead of samba. Pretty simple. Lots of howtos available online on how to set it up.
Ryzen x1800 Asus Prime x370-Pro 32 gigs Ram RX480 graphics
Dell PE T610, Dell PE T710
- List your hardware Profile: inxi -Fxpmrz
MeshCentral * Virtualbox * Debian * InvoiceNinja * NextCloud * Linux since kernel 2.0.36
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: Unable to set up Samba networking - need fresh start

Post by altair4 »

Samba between two Linux machines is fairly simple. Mint makes it hard.

We need to know where you are at so if you could post the output of the following commands it would help:

Code: Select all

testparm -s

Code: Select all

net usershare info --long
If you get nothing but errors when you do that I would suggest you start installing things - and do it the Ubuntu way so you get the complete setup. Do this on both Linux machines:

Code: Select all

sudo apt-get install samba --install-recommends

Code: Select all

sudo apt-get install gvfs-backends
Now run this command on both machines so you can determine the host name of each:

Code: Select all

hostname
Now ping one machine from the other - replacing hostname with it's actual host name - and don't forget the ".local" at the end:

Code: Select all

ping hostname.local -c4
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
autumnleaves

Re: Unable to set up Samba networking - need fresh start

Post by autumnleaves »

Thanks for the detailed responses. I will have to take some time to figure out NFS. Meanwhile, here is what the diagnostics show for my first computer. I had uninstalled Samba prior to running.

Code: Select all

Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
WARNING: The "syslog" option is deprecated
Processing section "[printers]"
Processing section "[print$]"
Processing section "[data_server]"
Loaded services file OK.
Server role: ROLE_STANDALONE

# Global parameters
[global]
	server string = %h server (Samba, Ubuntu)
	server role = standalone server
	map to guest = Bad User
	obey pam restrictions = Yes
	pam password change = Yes
	passwd program = /usr/bin/passwd %u
	passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
	unix password sync = Yes
	syslog = 0
	log file = /var/log/samba/log.%m
	max log size = 1000
	dns proxy = No
	usershare allow guests = Yes
	usershare owner only = No
	panic action = /usr/share/samba/panic-action %d
	idmap config * : backend = tdb


[printers]
	comment = All Printers
	path = /var/spool/samba
	create mask = 0700
	printable = Yes
	browseable = No


[print$]
	comment = Printer Drivers
	path = /var/lib/samba/printers


[data_server]
	path = /media/priam/Montage
	read only = No
	guest ok = Yes

info_fn: file /var/lib/samba/usershares/montage is not a well formed usershare file.
info_fn: Error was Path is not a directory.
info_fn: file /var/lib/samba/usershares/closet is not a well formed usershare file.
info_fn: Error was Path is not a directory.
[Cinema]
path=/media/priam/Cinema
comment=
usershare_acl=Everyone:F,
guest_ok=y

info_fn: file /var/lib/samba/usershares/trunk is not a well formed usershare file.
info_fn: Error was Path is not a directory.
Is the method set out here worth considering? <https://youtu.be/-wUfzdiE4m8>

Thanks
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: Unable to set up Samba networking - need fresh start

Post by altair4 »

You created two shares using two different methods.

This one is the traditional way of creating a share - it's in smb.conf:
[data_server]
path = /media/priam/Montage
read only = No
guest ok = Yes
This one you created in Nemo - your file manager:
[Cinema]
path=/media/priam/Cinema
comment=
usershare_acl=Everyone:F,
guest_ok=y
There's nothing wrong with either of them ..... unless priam is your user name.

If it is your user name the system set up the /media/priam folder in such a way that only "priam" can get past it. Both your shares allow guest access but "guest" is not "priam" so Samba lets the guest in but Linux does not.

Make the guest appear to be priam - at least for these samba shares:

Edit smb.conf:

Code: Select all

gksu xed /etc/samba/smb.conf
Right under the workgroup = WORKGROUPline add this one:

Code: Select all

force user = priam
Save the file. Then restart smbd:

Code: Select all

sudo service smbd restart
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
autumnleaves

Re: Unable to set up Samba networking - need fresh start

Post by autumnleaves »

Thanks for your recommendations Altair. I wonder though if it might be preferable to wipe out the shares completely and start from scratch. That way I will know the proper way to execute the setup rather than just patch an existing problem.
If it simplifies matters I wonder if I should change the username, as the computer with which I am networking has the same username, and I'm afraid this may confuse matters.
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: Unable to set up Samba networking - need fresh start

Post by altair4 »

You are not patching an existing problem.

** Linux offers two ways to create samba shares and you chose both. As long as you don't share the same folder using both methods at the same time there is nothing wrong with that.

** There is nothing wrong with the shares you have now. You just encountered a peculiarity about the /media/$USER folder. If you recreate the same shares at the same place the force user = $USER parameter will still be required.

** And based on the rest of the output of testparm -s everything is normal.

If the force user = priam suggestion fixes your permissions issue when accessing the share don't fix what ain't broke.


EDIT: If you have the need to clean things up you could take care of these errors:
info_fn: file /var/lib/samba/usershares/montage is not a well formed usershare file.
info_fn: Error was Path is not a directory.
info_fn: file /var/lib/samba/usershares/closet is not a well formed usershare file.
info_fn: Error was Path is not a directory.
Go to /var/lib/samba/usershares and look at the content of the montage and closet files you find there. They should both be share definitions and look something like this example:
#VERSION 2
path=/some/path
comment=
usershare_acl=S-1-1-0:F
guest_ok=y
sharename=something
Just delete the files.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
autumnleaves

Re: Unable to set up Samba networking - need fresh start

Post by autumnleaves »

Sorry for the delay, and thank you for the detailed explanations. However, after carrying out the changes you mention (including deletion of files in /var/lib/samba) there is no sign of any shares in Windows Network, or anywhere else. Error received is: Unable to mount location. Failed to retrieve share list from server. No such file or directory.

Shall we start over from the top?
Thanks,
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: Unable to set up Samba networking - need fresh start

Post by altair4 »

[1] Find the host name of the machine you are trying to contact by going to that machine and running this command:

Code: Select all

hostname
[2] Now on your other machine run this command to connect to it:

Code: Select all

nemo smb://hostname.local
Replace hostname with the one you found in step [1] - and don't forget the .local at the end.

When nemo opens to that location Bookmark it.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
User avatar
coffee412
Level 8
Level 8
Posts: 2271
Joined: Mon Nov 12, 2012 7:38 pm
Location: I dont know
Contact:

Re: Unable to set up Samba networking - need fresh start

Post by coffee412 »

autumnleaves wrote:Error received is: Unable to mount location. Failed to retrieve share list from server. No such file or directory.
On your client machine that you are trying to get to the shares make sure you have samba-common installed.

I know that just installing samba (apt install samba) does not install everything by default as I remember.
Ryzen x1800 Asus Prime x370-Pro 32 gigs Ram RX480 graphics
Dell PE T610, Dell PE T710
- List your hardware Profile: inxi -Fxpmrz
MeshCentral * Virtualbox * Debian * InvoiceNinja * NextCloud * Linux since kernel 2.0.36
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: Unable to set up Samba networking - need fresh start

Post by altair4 »

It will if you install it this way:
altair4 wrote:If you get nothing but errors when you do that I would suggest you start installing things - and do it the Ubuntu way so you get the complete setup. Do this on both Linux machines:

Code: Select all

sudo apt-get install samba --install-recommends

Code: Select all

sudo apt-get install gvfs-backends
:)
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
autumnleaves

Re: Unable to set up Samba networking - need fresh start

Post by autumnleaves »

Thank you all for your help. I have verified that all the packages you recommend are present. This is being written on the second of the two machines, with hostname Troy. On Troy via Nemo the shared Troy is visible when I click on Network, as well as a Windows Network. Shared drives on Troy show up when I click on the networked machine. If I click on Windows Networks, I see the network I tried to set up (Achaeans) and Workgroup. Inside Achaeans is the aforementioned Troy machine as a Windows share. I am not able to enter Workgroup (as Priam) without a password, though I don't recall setting one.
From Troy I am able to ping the other machine, Mycenae. I will go to Mycenae and report from there.
Your help is much appreciated.
autumnleaves

Re: Unable to set up Samba networking - need fresh start

Post by autumnleaves »

Now back on the Mycenae machine. (Note that I did not delete usershare files on the Troy machine.)

I am able to ping Troy from Mycenae.

If I click on Networks in Nemo I see Windows Network. Clicking on WIndows Network produces the same message as previously (Unable to mount location...).
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: Unable to set up Samba networking - need fresh start

Post by altair4 »

You and I appear to be going in two different directions. You seem to want to go to Network > Windows Network to find your Linux hosts. When you do that you are using Windows' networking protocol ( netbios ) to discover the other machine.

What I am suggesting is not using the Windows protocol but a native Linux protocol to do that. This is what nemo smb://troy.local and nemo smb://mycenae.localdo.

If you really want to discover the other machine in a reliable method using the native Linux way under Network instead of just using a bookmark ( map ) do this:

On both machines:

[1] Create a new file:

Code: Select all

gksu xed /etc/avahi/services/samba.service
[2] Add this to it:

Code: Select all

<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
   <name replace-wildcards="yes">%h SMB</name> ## Display Name
   <service>
       <type>_smb._tcp</type>
       <port>445</port>
   </service>
</service-group>
Save the file.

That's it. Your mnachines will show up under Network - not "Windows Network".

Or ... Install Ubuntu or Xubuntu 17.10 which does this automatically for you without user intervention in a much more elegant way.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
autumnleaves

Re: Unable to set up Samba networking - need fresh start

Post by autumnleaves »

Having tried your suggestion altair, here is the current status.

Troy: Under Network, Troy sees itself and can mount the shared drives. It also sees Mycenae SMB but cannot mount (Failed to see share list from server...)

Under Windows Network there are still Achaeans and Workgroup. Under Achaeans is Troy. Workgroup won't open.

Mycenae: Under Network, Mycenae sees itself as Mycenae SMB and can mount shared drives. It does not see Troy. Windows Network is there but location cannot be mounted.

Much obliged for your insights and advice.
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: Unable to set up Samba networking - need fresh start

Post by altair4 »

Troy: Under Network, Troy sees itself and can mount the shared drives. It also sees Mycenae SMB but cannot mount (Failed to see share list from server...)
Need to see how you are configured on Mycenae:

Code: Select all

testparm -s

Code: Select all

net usershare info --long
BTW, I have never seen that error - not once -- while using avahi. Something else is either miscongured on that box, a firewall is in the way, or your two machines are in different networks.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
autumnleaves

Re: Unable to set up Samba networking - need fresh start

Post by autumnleaves »

Perceiving that drastic measures my be in order, in a fit of apoplexy I decided to purge and reinstall samba in the hope of getting over the hurdle that confronts us. All went well with Troy, but not so with Mycenae. Samba takes a dive before it reaches the finish line. Here's the diagnostic.

Code: Select all

-- Unit smbd.service has begun starting up.
Jan 18 20:01:19 Mycenae smbd[5287]:  * Starting SMB/CIFS daemon smbd
Jan 18 20:01:19 Mycenae smbd[5287]:    ...fail!
Jan 18 20:01:19 Mycenae systemd[1]: smbd.service: Control process exited, code=exited status=1
Jan 18 20:01:19 Mycenae systemd[1]: Failed to start LSB: start Samba SMB/CIFS daemon (smbd).
-- Subject: Unit smbd.service has failed
-- Defined-By: systemd
so
When rebooting the machine I was reminded that it had been slow starting for a while, much slower than Troy. So I analyzed blame and discovered a number of culprits slowing the system down. Here are the ones occupying more than just milliseconds.

Code: Select all

         15.445s dev-sda1.device
         14.835s ufw.service
         13.793s lvm2-monitor.service
         13.654s systemd-modules-load.service
         10.888s systemd-udevd.service
          9.851s NetworkManager-wait-online.service
          7.179s keyboard-setup.service
          2.688s systemd-tmpfiles-setup-dev.service
          1.504s lightdm.service
          1.396s grub-common.service
          1.349s NetworkManager.service
Is it possible that a general blockage could be at the root of the samba problems? More to come. Thanks again.
autumnleaves

Re: Unable to set up Samba networking - need fresh start

Post by autumnleaves »

Code: Select all

priam@Mycenae ~ $ testparm -s
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Error loading services.
altair4
Level 20
Level 20
Posts: 11458
Joined: Tue Feb 03, 2009 10:27 am

Re: Unable to set up Samba networking - need fresh start

Post by altair4 »

Take a look at the content of /etc/samba/smb.conf:

Code: Select all

cat /etc/samba/smb.conf
You might want to post the output to the forum.

Then look at the the content of the factory restore smb.conf:

Code: Select all

cat /usr/share/samba/smb.conf
They should match.

If they don't:
[1] Backup your current smb.conf:

Code: Select all

sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.orig
[2] Copy the restore smb.conf to the default location:

Code: Select all

sudo cp -a /usr/share/samba/smb.conf /etc/samba
[3] Run testparm -s to validate that there are no errors:

Code: Select all

testparm -s
[4] If there are no errors restart smbd:

Code: Select all

sudo service smbd restart
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
autumnleaves

Re: Unable to set up Samba networking - need fresh start

Post by autumnleaves »

Thanks for your suggestions. Unfortunately there is no /etc/samba directory because the reinstallation of Samba did not complete due to errors

Code: Select all

priam@Mycenae ~ $ sudo apt-get install samba
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  bind9 bind9utils ctdb ldb-tools smbldap-tools winbind
Recommended packages:
  samba-dsdb-modules samba-vfs-modules
The following NEW packages will be installed:
  samba
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/899 kB of archives.
After this operation, 11.5 MB of additional disk space will be used.
Selecting previously unselected package samba.
(Reading database ... 392549 files and directories currently installed.)
Preparing to unpack .../samba_2%3a4.3.11+dfsg-0ubuntu0.16.04.12_amd64.deb ...
Unpacking samba (2:4.3.11+dfsg-0ubuntu0.16.04.12) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (229-4ubuntu21) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up samba (2:4.3.11+dfsg-0ubuntu0.16.04.12) ...
Job for smbd.service failed because the control process exited with error code. See "systemctl status smbd.service" and "journalctl -xe" for details.
invoke-rc.d: initscript smbd, action "start" failed.
● smbd.service - LSB: start Samba SMB/CIFS daemon (smbd)
   Loaded: loaded (/etc/init.d/smbd; bad; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2018-01-19 09:50:38 EST; 2ms ago
     Docs: man:systemd-sysv-generator(8)
  Process: 29226 ExecStart=/etc/init.d/smbd start (code=exited, status=1/FAILURE)

Jan 19 09:50:37 Mycenae systemd[1]: Starting LSB: start Samba SMB/CIFS daem.....
Jan 19 09:50:38 Mycenae smbd[29226]:  * Starting SMB/CIFS daemon smbd
Jan 19 09:50:38 Mycenae smbd[29226]:    ...fail!
Jan 19 09:50:38 Mycenae systemd[1]: smbd.service: Control process exited, c...=1
Jan 19 09:50:38 Mycenae systemd[1]: Failed to start LSB: start Samba SMB/CI...).
Jan 19 09:50:38 Mycenae systemd[1]: smbd.service: Unit entered failed state.
Jan 19 09:50:38 Mycenae systemd[1]: smbd.service: Failed with result 'exit-...'.
Hint: Some lines were ellipsized, use -l to show in full.
dpkg: error processing package samba (--configure):
 subprocess installed post-installation script returned error exit status 1
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for systemd (229-4ubuntu21) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Errors were encountered while processing:
 samba
E: Sub-process /usr/bin/dpkg returned an error code (1)
Locked

Return to “Networking”