How to get Samba to work [SOLVED?]

Archived topics about LMDE 1 and LMDE 2
mike acker
Level 7
Level 7
Posts: 1517
Joined: Wed Jul 31, 2013 6:29 pm
Location: Kalamazoo, MI

How to get Samba to work [SOLVED?]

Post by mike acker »

altair4 wrote:
mike acker wrote:consider me added to the Interested Parties list

i have never been able to get Samba to work . i think we need an alternative that doesn't use any windows stuff -- workgroups -- etc
Why not start your own thread. Post the output of the following commands so we can see how you are set up and what you've already done:

Code: Select all

testparm -s

Code: Select all

net usershare info --long
And you can run Samba without any "Windows stuff".
++ thanks for the reply !!

here's what i have now, on machine "Acker4" :

Code: Select all

mike@acker4 ~ $ testparm -s
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Processing section "[print$]"
Processing section "[Public]"
Loaded services file OK.
Server role: ROLE_STANDALONE

# Global parameters
[global]
	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
	panic action = /usr/share/samba/panic-action %d
	idmap config * : backend = tdb


[homes]
	comment = Home Directories
	valid users = %S
	create mask = 0700
	directory mask = 0700
	browseable = No


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


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


[Public]
	comment = Public Share Acker4p
	path = /home/mike/Public
	read only = No
mike@acker4 ~ $ net usershare info --long
[Acker4P]
path=/home/mike/Public
comment=Public Share System Acker4
usershare_acl=Everyone:F,
guest_ok=y
mike@acker4 ~ $ 
this data is for the 1st machine; there are several others. ideally, the /Public directory of any system that's logged on -- should be available to any of the other machines; these are all on one WiFi Net; the WiFi router has a firewall to block any traffic from the outside net.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 4 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
¡Viva la Resistencia!
altair4
Level 20
Level 20
Posts: 11452
Joined: Tue Feb 03, 2009 10:27 am

Re: How to get Samba to work

Post by altair4 »

** Disable the firewall on this machine if you are using one to make sure it doesn't get in the way:

Code: Select all

sudo ufw disable. 
You will need ports 445 and 5353 open which you can do after we determine if that's been the problem.

** Add yourself to the samba password database:

Code: Select all

sudo smbpasswd -a mike
** You should be able to access your home directory from any of your Linux clients. Let's say the other Linux client uses Cinnamon as the DE:

Code: Select all

nemo smb://acker4.local/mike
** You are using two different methods to share the same folder and they don't match.

I'm not sure why you have two shares of the /home/mike/Public folder with different settings - one requires credentials the other does not. As long as they have two different labels I suppose that's OK.

Code: Select all

nemo smb://acker4.local/Public
nemo smb://acker4.local/Acker4P
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
mike acker
Level 7
Level 7
Posts: 1517
Joined: Wed Jul 31, 2013 6:29 pm
Location: Kalamazoo, MI

Re: How to get Samba to work

Post by mike acker »

thanks

i'll work on this and see if i can clean it up,-- I had fiddled with it a bit and probably made a mess :oops:
¡Viva la Resistencia!
mike acker
Level 7
Level 7
Posts: 1517
Joined: Wed Jul 31, 2013 6:29 pm
Location: Kalamazoo, MI

Re: How to get Samba to work

Post by mike acker »

is there any way we can work thru this 1 step at a time?

(1) if we are going to define the shares in the smb.conf then they should not be defined using nemo.

accordingly I removed the share specs from /Public using Nemo, and then checked in

Code: Select all

/var/lib/samba/usershares
usershares was found to be empty.

---

(2) Samba Passwords. evidently samba passwords are kept in a separate database. the content of this database can then be listed using

Code: Select all

pdbedit -L -v
this was found to be empty so therefore i used the

Code: Select all

sudo smbpassed -a <username>
command to add my username to the database. this worked and i used the list command to check this. it appears to be OK

---

a Quick Note: I'm working with 4 machines. as I'm admin on all of them the user name is the same on each machine although each machine has it's own machine name .

"acker4" is the main machine; I need to share the /Public directory from that machine to the others;

---


(3) it does not appear there is a Linux Group for Samba -- as there is for Virtualbox.


(4) /etc/samba/smb.conf

it is not at all clear what to do with this

evidently it is only needed to define the public share or shares
in the last section of the conf file:

Code: Select all


[Public]
comment = Public Share acker4p
path = /home/mike/Public
browsable = yes
read only = no
I really want to kickout anything windows related so i changed workgroup to "SMB" instead of "WORKGROUP"

---

after adjusting smb.conf I restarted samba

Code: Select all

sudo service smbd restart

Code: Select all

testparm
reported no errors

-----

attempting access from another machine -- failed: timeout

using NEMO I clicked the NETWORK key. this offered "WORKGROUP" -- which opened, and revealed SMB within. attempting to connect to SMB -- timed out.

I've had this work -- only on occasion -- but when it does -- a machine ICON appears labeled acker4. it this happens -- i'm able to connect. i'd like it to connect all the time. if a "workgroup" appears it's no use. how can i get rid of workgroup forever?

-----
updated reports

Code: Select all

mike@acker4 ~ $ testparm -s
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Processing section "[print$]"
Processing section "[Public]"
Loaded services file OK.
Server role: ROLE_STANDALONE

# Global parameters
[global]
	workgroup = SMB
	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
	panic action = /usr/share/samba/panic-action %d
	idmap config * : backend = tdb


[homes]
	comment = Home Directories
	valid users = %S
	create mask = 0700
	directory mask = 0700
	browseable = No


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


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


[Public]
	comment = Public Share acker4p
	path = /home/mike/Public
	read only = No
mike@acker4 ~ $ net usershare info --long
mike@acker4 ~ $ 

¡Viva la Resistencia!
altair4
Level 20
Level 20
Posts: 11452
Joined: Tue Feb 03, 2009 10:27 am

Re: How to get Samba to work

Post by altair4 »

using NEMO I clicked the NETWORK key. this offered "WORKGROUP" -- which opened, and revealed SMB within. attempting to connect to SMB -- timed out.
That's the Microsoft way.

Do it the Linux way.

In a terminal run:

Code: Select all

nemo smb://acker4.local/public
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
mike acker
Level 7
Level 7
Posts: 1517
Joined: Wed Jul 31, 2013 6:29 pm
Location: Kalamazoo, MI

Re: How to get Samba to work

Post by mike acker »

altair4 wrote:
using NEMO I clicked the NETWORK key. this offered "WORKGROUP" -- which opened, and revealed SMB within. attempting to connect to SMB -- timed out.
That's the Microsoft way.

Do it the Linux way.

In a terminal run:

Code: Select all

nemo smb://acker4.local/public
success :D

it snapped in in less than a second
¡Viva la Resistencia!
mike acker
Level 7
Level 7
Posts: 1517
Joined: Wed Jul 31, 2013 6:29 pm
Location: Kalamazoo, MI

Re: How to get Samba to work

Post by mike acker »

can we expand it slightly with additional users?

"acker1" -- is a "Family Computer" -- and 4 different people have logons for it. can they have user names and passwords to get to /acker4/public ?

i shouldn't give out the admin password for the main resource (acker4)
¡Viva la Resistencia!
altair4
Level 20
Level 20
Posts: 11452
Joined: Tue Feb 03, 2009 10:27 am

Re: How to get Samba to work

Post by altair4 »

i shouldn't give out the admin password for the main resource (acker4)
The samba password doesn't have to match the login password. If you log into that machine with an XXX password you can make the samba password YYY.

You can also have different users and passwords as long as you make sure the permissions on the /home/mike/Public folder itself - I'm talking about Linux permissions not samba permissions - allows a write to them.

If you want everyone to have read / write access to everything in the share you might consider adding one more line to the share definition:
[Public]
comment = Public Share acker4p
path = /home/mike/Public
browsable = yes
read only = no
force user = mike
The share will still require a user name and password to gain access but after it is accepted everything in that share will be as "mike" - at least for that share only. This eliminates any potential permissions issues.

EDIT: Way .. way past my bedtime. I will check back tomorrow.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
mike acker
Level 7
Level 7
Posts: 1517
Joined: Wed Jul 31, 2013 6:29 pm
Location: Kalamazoo, MI

Re: How to get Samba to work

Post by mike acker »

thanks
:D :D :D :D :D
¡Viva la Resistencia!
mike acker
Level 7
Level 7
Posts: 1517
Joined: Wed Jul 31, 2013 6:29 pm
Location: Kalamazoo, MI

Re: How to get Samba to work

Post by mike acker »

altair4 wrote:
using NEMO I clicked the NETWORK key. this offered "WORKGROUP" -- which opened, and revealed SMB within. attempting to connect to SMB -- timed out.
That's the Microsoft way.

Do it the Linux way.

In a terminal run:

Code: Select all

nemo smb://acker4.local/public
hmmmmmm :?:

this worked yesterday but this morning:
smb_fail.png
why is it * about windows again ?
¡Viva la Resistencia!
altair4
Level 20
Level 20
Posts: 11452
Joined: Tue Feb 03, 2009 10:27 am

Re: How to get Samba to work [SOLVED?]

Post by altair4 »

Why is the "acker" part of "acker4.local" missing from the error message?
why is it * about windows again ?
The people that put together Linux know nothing about Samba. They equate "smb" with Windows. They are confused.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
mike acker
Level 7
Level 7
Posts: 1517
Joined: Wed Jul 31, 2013 6:29 pm
Location: Kalamazoo, MI

Re: How to get Samba to work [SOLVED?]

Post by mike acker »

altair4 wrote:Why is the "acker" part of "acker4.local" missing from the error message?
why is it * about windows again ?
The people that put together Linux know nothing about Samba. They equate "smb" with Windows. They are confused.
"acker" -- missing : yes: that's not the real name of the machine -- for security reasons. I just blanked it out with a graphic editor.

i think -- if i re-run the service restart smbda that it might get going again,.... that, i think, may be the difference between this morning's test and last night's.

so,...... "Samba" isn't real Linux stuff, -eh? Figures. MSFT will want everyone to use their "One Drive".

<-->

if i remember rigtht we had also discussed shifting this to an FTP solution. That would necessitate activating an FTP server on the man machine ("acker4").

the machines here all work with a WiFi net. I use an ASUS WiFi router and that does effect a Firewall against the external (Charter.net).

an FTP solution would probably listen on port 21. it would be critical that that port were not exposed to the external net.

thoughts?

for right now I'll just re-test after I run the service restart smbda on "acker4". that might fix it. one of the things's I've noticed in trying to get Samba working is that...... I get inconsistent results: sometimes it works, sometimes it takes a while to connect and sometimes it times out.

right now it's too hot to run tests. I'll turn the A/C on about 1600 (2000 GMT) and give it a try a bit later,--

this may be the key that i'm missing: i don't think i have that group let alone be a member of it:
** Made myself a member of the sambashare group: sudo gpasswd -a tester sambashare
Why LMDE does not make you a member of this group by default is a mystery.

Thanks 100+ for all the help !!!
¡Viva la Resistencia!
altair4
Level 20
Level 20
Posts: 11452
Joined: Tue Feb 03, 2009 10:27 am

Re: How to get Samba to work [SOLVED?]

Post by altair4 »

You've got a lot of different comments there.
this may be the key that i'm missing: i don't think i have that group let alone be a member of it:

** Made myself a member of the sambashare group: sudo gpasswd -a tester sambashare
Why LMDE does not make you a member of this group by default is a mystery.
In your case it doesn't matter if you are a member of the sambashare group. sambashare is related to usershare and you don't use Nemo to create samba shares. You have them all defined in smb.conf.
i think -- if i re-run the service restart smbda that it might get going again,.... that, i think, may be the difference between this morning's test and last night's.
The samba services are not in the habit of stopping by themselves. If you need to do this every time you boot you have bigger problems than samba.
if i remember rigtht we had also discussed shifting this to an FTP solution. That would necessitate activating an FTP server on the man machine ("acker4").
the machines here all work with a WiFi net. I use an ASUS WiFi router and that does effect a Firewall against the external (Charter.net).
an FTP solution would probably listen on port 21. it would be critical that that port were not exposed to the external net.
thoughts?
As long as your Linux box is behind that router none of your ports - be they FTP, Samba, or whatever - are exposed to the external net.

mDNS which is what is being used here when you do a nemo smb://acker4.local/public is fairly reliable - by far more reliable that the Microsoft way. But it requires two things:

[1] The avahi-daemon service must be running on all your linux machines. To find out:

Code: Select all

sudo service avahi-daemon status
If it's not running start it: sudo service avahi-daemon start

[2] Port 5353 must be open on all your machines. If you don't have a firewall active on each machine this should not be a problem.

And you can always do a quick check to see if mDNS is working by pinging the other boxes by their mDNS host name. Like this:

Code: Select all

ping acker4.local -c3
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
mike acker
Level 7
Level 7
Posts: 1517
Joined: Wed Jul 31, 2013 6:29 pm
Location: Kalamazoo, MI

Re: How to get Samba to work [SOLVED?]

Post by mike acker »

And you can always do a quick check to see if mDNS is working by pinging the other boxes by their mDNS host name. Like this:

Code: Select all
ping acker4.local -c3
now we are getting somewhere!!

initially this afternoon: the PINGs failed: host not identified.

I broke net connection on both machines and power-cycled the ASUS/WiFi then re-connected both machines.

after that the ping resolved although I had to try twice to get success on the 2d machine ( "acker1" ).

when the pings were working I was able to connect using the

Code: Select all

nemo smb://acker4.local/public
command :D

So: at this point the PMR will be updated to indicate the problem is being caused by the ASUS RT-10NP wireless router. I'll keep an eye on this in order to be sure the problem is reproduceable...
¡Viva la Resistencia!
mike acker
Level 7
Level 7
Posts: 1517
Joined: Wed Jul 31, 2013 6:29 pm
Location: Kalamazoo, MI

Re: How to get Samba to work [SOLVED?]

Post by mike acker »

Interesting:

this morning after I brought the 2d system ("Acker1") online I tried to ping back to the main box ("Acker4").

result: Unkonwn Host.

I returned to the main box ("Acker4") and switched off the internet connection, waited for the disconnect message, and then switched it back on.

after that completed the ping from "Acker1" to "Acker4" was successful.

somebody is timing out and dropping the connect info... the router ? "Acker4" ? or maybe the connection was never properly established on boot-up? tw I'll try doing the disconnect\reconnect thing before I start reading the morning noise

right now I'm wondering if it may be the case that the LMDE system broadcasts is presence to everyone listening on the intranet -- when it connects -- and maybe it's supposed to repeat that once every minute or so. or maybe it's just very slow about getting the message out ? it will be interesting to see what i can ferret out....
¡Viva la Resistencia!
mike acker
Level 7
Level 7
Posts: 1517
Joined: Wed Jul 31, 2013 6:29 pm
Location: Kalamazoo, MI

Re: How to get Samba to work [SOLVED?]

Post by mike acker »

The Plot Thickens....

this morning I powered off the remote workstation -- "Acker1" and then restarted it.

after that it was unable to ping the main system -- "Acker4"

on Acker4 I switched the internet connection off and back on. after that Acker1 was able to ping Acker4 properly.

aside:

"SMB" = "Server Message Block" -- one of the components of MSFT/Windows that has been a favorite attack vector. It's probably ok to use it within an intranet. Perhaps we'll have a better solution sometime.
¡Viva la Resistencia!
kevinthefixer
Level 4
Level 4
Posts: 280
Joined: Thu Jul 23, 2015 10:36 pm

Re: How to get Samba to work [SOLVED?]

Post by kevinthefixer »

Mike, have you tried doing a full power-down and reboot of the router? Amazing how often this solves oddball problems like this. If you can, it might be a good idea to test-run a different router also. How old is the current one?
mike acker
Level 7
Level 7
Posts: 1517
Joined: Wed Jul 31, 2013 6:29 pm
Location: Kalamazoo, MI

Re: How to get Samba to work [SOLVED?]

Post by mike acker »

kevinthefixer wrote:Mike, have you tried doing a full power-down and reboot of the router? Amazing how often this solves oddball problems like this. If you can, it might be a good idea to test-run a different router also. How old is the current one?
it is ASUS RT-N10P

I can display the Client List. right now there are 4 clients i have 192.168.1.228
it shows all kinds of interesting info though

LMDE/2 shows default route and DNS as 192.168.1.1 -- the ASUS Router address. So, if I ping <client> it's the ASUS that should send that to whatever IP address it has that client on at that time...

so,--- we could have a problem in the ASUS -- as you suggest -- or -- LMDE might be holding what it thinks is the IP for a certain client..... i don't know if it does that. the ASUS does have a "RESET" optionon the client list; when I activated that it cut the client list down to just the machines currently connected, --- me, the printer, the general use table box, and some phone someplace....

I do have a new router on order,-- (1) to get dual band RF and all the new security codes, and (2) a bit better range.
¡Viva la Resistencia!
mike acker
Level 7
Level 7
Posts: 1517
Joined: Wed Jul 31, 2013 6:29 pm
Location: Kalamazoo, MI

Re: How to get Samba to work [SOLVED?]

Post by mike acker »

Server Message Block (SMB)

an article on Computerworldthis morning kicks SMB under the bus:

Excerpt
Microsoft engineers hate the protocol. Consider what Ned Pyle, principal program manager in the Microsoft Windows Server High Availability and Storage group, had to say about it in a prescient blog in September 2016:

“Stop using SMB1. Stop using SMB1. STOP USING SMB1!... The original SMB1 protocol is nearly 30 years old, and like much of the software made in the 80’s, it was designed for a world that no longer exists. A world without malicious actors, without vast sets of important data, without near-universal computer usage. Frankly, its naivete is staggering when viewed though modern eyes.”
while we're at it: Samba needs to join SMB, --under the bus.
¡Viva la Resistencia!
altair4
Level 20
Level 20
Posts: 11452
Joined: Tue Feb 03, 2009 10:27 am

Re: How to get Samba to work [SOLVED?]

Post by altair4 »

SMB1 is a dialect of SMB. There are several dialects of SMB: SMB1, SMB2, and SMB3. And under those there are sub-dialects like SMB3.11 for example.

Removing SMB1 is not removing SMB.

SMB / Samba has become universal. Windows does it. MacOS since Mavericks does it by default. Most networked storage devices do it. Even educated fleas do it .
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Locked

Return to “LMDE Archive”