LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-06-2022, 05:27 AM   #1
Lestrad
Member
 
Registered: Mar 2015
Posts: 43

Rep: Reputation: Disabled
"Hosts allow" causes Samba shares to block Windows7


Hello. I'm trying to connect to the Samba shares on my LAN with my Android cell phone, and keep getting "Connection refused" errors. So I tried adding "hosts allow = xxx.xxx.x" to my smb.conf file under [global], but when I do that the Windows computers on the LAN can't connect to the shares anymore. systemctl status smb.service shows that access is being denied. As soon as I remove the "hosts allow" line and restart smb.service, I can connect with Windows again, but still not with Android.

My Linux version is Arch Linux, Samba version 4.12.3

I'll gladly provide any further information anyone might need. TIA!
 
Old 07-06-2022, 07:28 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,783

Rep: Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936
I assume you are using the AndSMB client and without knowing anything about the software or what SMB protocols it supports it is difficult to provide help.

Instead I would use the AndFTP client and connect using sftp. However, my first guess would be that the client is using SMB1 which is turned off by default with versions 4.11+. You can try adding min protocol = SMB1 to the [global] section and restarting samba.
 
1 members found this post helpful.
Old 07-06-2022, 08:52 AM   #3
Lestrad
Member
 
Registered: Mar 2015
Posts: 43

Original Poster
Rep: Reputation: Disabled
Thanks. I'm trying to connect using the X-plore file manager application. The app can also connect to FTP servers; I tried that and got the same error (Connection Refused).
 
Old 07-06-2022, 09:14 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,783

Rep: Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936
A linux FTP server is not installed by default.

A quick search reveals that X-plore does indeed support SMB1 and SMB2 so it should work. I am not familiar with this app but are you using the same credentials as your Windows user?
 
Old 07-06-2022, 09:17 AM   #5
Lestrad
Member
 
Registered: Mar 2015
Posts: 43

Original Poster
Rep: Reputation: Disabled
I tried adding, the "SMB1"; no help. I added the server IP instead of the server name and now the error message is: "Invalid SMB status STATUS_ACCESS_DENIED"
 
Old 07-06-2022, 09:33 AM   #6
Lestrad
Member
 
Registered: Mar 2015
Posts: 43

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
A linux FTP server is not installed by default.

A quick search reveals that X-plore does indeed support SMB1 and SMB2 so it should work. I am not familiar with this app but are you using the same credentials as your Windows user?
I've tried both the Windows credentials and the credentials for the Linux box... Still getting "STATUS_ACCESS_DENIED"
 
Old 07-06-2022, 09:49 AM   #7
Lestrad
Member
 
Registered: Mar 2015
Posts: 43

Original Poster
Rep: Reputation: Disabled
Actually when I add SMB1, the smb.service refuses to start...
 
Old 07-06-2022, 09:54 AM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,783

Rep: Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936
Maybe bad syntax. Use testparm command to check.

are you entering the correct credentials?
 
Old 07-06-2022, 02:49 PM   #9
Lestrad
Member
 
Registered: Mar 2015
Posts: 43

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
Maybe bad syntax. Use testparm command to check.

are you entering the correct credentials?
Testparm checks out.

To be totally honest, I'm not sure what the correct credentials are. I've tried the credentials I use to access the Linux box and the Windows credentials. I don't know where to look for the right ones. I tried pbedit -L -v as per the Arch manual, but it didn't show anything.
 
Old 07-06-2022, 07:49 PM   #10
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,382
Blog Entries: 28

Rep: Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164Reputation: 6164
This is a shot in the dark. Have you configured your smbpasswd file? See man smbpasswd for more.

Last edited by frankbell; 07-06-2022 at 07:53 PM.
 
Old 07-07-2022, 01:47 AM   #11
Lestrad
Member
 
Registered: Mar 2015
Posts: 43

Original Poster
Rep: Reputation: Disabled
Thanks! I don't see from the man how to open the "smbpasswd file"... Here's what I get when I run smbpasswd as root: Does it tell you anything?

Quote:
root@alarm samba]# smbpasswd
INFO: Current debug levels:
all: 10
tdb: 10
printdrivers: 10
lanman: 10
smb: 10
rpc_parse: 10
rpc_srv: 10
rpc_cli: 10
passdb: 10
sam: 10
auth: 10
winbind: 10
vfs: 10
idmap: 10
quota: 10
acls: 10
locking: 10
msdfs: 10
dmapi: 10
registry: 10
scavenger: 10
dns: 10
ldb: 10
tevent: 10
auth_audit: 10
auth_json_audit: 10
kerberos: 10
drs_repl: 10
smb2: 10
smb2_credits: 10
dsdb_audit: 10
dsdb_json_audit: 10
dsdb_password_audit: 10
dsdb_password_json_audit: 10
dsdb_transaction_audit: 10
dsdb_transaction_json_audit: 10
dsdb_group_audit: 10
dsdb_group_json_audit: 10
doing parameter debug timestamp = yes
doing parameter load printers = no
doing parameter printing = bsd
doing parameter printcap name = /dev/null
doing parameter disable spoolss = yes
pm_process() returned Yes
lp_servicenumber: couldn't find homes
Netbios name list:-
my_netbios_names[0]="ALARM"
Attempting to register passdb backend samba_dsdb
Successfully added passdb backend 'samba_dsdb'
Attempting to register passdb backend samba4
Successfully added passdb backend 'samba4'
Attempting to find a passdb backend to match tdbsam (tdbsam)
No builtin backend found, trying to load plugin
load_module_absolute_path: Probing module '/usr/lib/samba/pdb/tdbsam.so'
load_module_absolute_path: Module '/usr/lib/samba/pdb/tdbsam.so' loaded
Attempting to register passdb backend tdbsam
Successfully added passdb backend 'tdbsam'
Found pdb backend tdbsam
pdb backend tdbsam has a valid init
New SMB password:

Last edited by Lestrad; 07-07-2022 at 01:50 AM.
 
Old 07-07-2022, 09:28 AM   #12
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,783

Rep: Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936
What ever username and password you use to connect from the Windows computer should work on the phone. I am not familiar with the app.
 
Old 07-08-2022, 01:08 AM   #13
Lestrad
Member
 
Registered: Mar 2015
Posts: 43

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
What ever username and password you use to connect from the Windows computer should work on the phone. I am not familiar with the app.
This is embarrassing, but I can't figure out how to get Windows to show me the password so I can check.

Meanwhile, I just discovered that if I use SSH File Transfer in X-plore instead of LAN or FTP, I can connect directly to the root of the server ("Alarm") and open the share with no problem, using the same credentials I'm using to try to connect to the share via LAN. (I don't seem to have write privileges, but I was able to delete a file.)

The attached screenshots from my phone show what the X-plore interface looks like. Under LAN you can see the STATUS_ACCESS_DENIED error message that appears when I try to connect to the share ("littlenas" or "Ltlns"). Under FTP you can see the "Connection Refused" error message when I try to connect that way, also with the same credentials.

So is SSH dangerously insecure, or is Samba just a pain in the a**? Meanwhile, I'm in!
Attached Thumbnails
Click image for larger version

Name:	Untitled.jpg
Views:	3
Size:	107.6 KB
ID:	39240   Click image for larger version

Name:	Screenshot_20220708-075705.png
Views:	4
Size:	159.3 KB
ID:	39242  

Last edited by Lestrad; 07-08-2022 at 01:31 AM.
 
Old 07-08-2022, 01:20 AM   #14
Lestrad
Member
 
Registered: Mar 2015
Posts: 43

Original Poster
Rep: Reputation: Disabled
---

Last edited by Lestrad; 07-08-2022 at 01:25 AM. Reason: Duplicate post, can't seem to delete...
 
Old 07-08-2022, 06:51 AM   #15
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,783

Rep: Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936
Samba can be a pain in the posterior. Using ssh can be easier but you can roam the entire filesystem and not just the shared directory. Permissions are just like you were sitting at the physical computer. I would consider it more secure then samba.
 
  


Reply

Tags
samba config allow hosts



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
/etc/hosts.deny/hosts.allow have no effect on sshd access bganesh Linux - Security 4 05-04-2006 08:06 PM
hosts.allow & hosts.deny question... jonc Linux - Security 9 03-05-2005 09:41 PM
Adding shell commands to hosts.deny and hosts.allow ridertech Linux - Security 3 12-29-2003 03:52 PM
hosts.deny and hosts.allow defaults? gui10 Linux - Security 5 12-20-2001 01:57 AM
hosts.allow / hosts.deny fistz Linux - Newbie 1 04-19-2001 07:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:30 AM.

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