Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] smb share setup ignorance
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
mitocram
n00b
n00b


Joined: 03 Jan 2023
Posts: 19

PostPosted: Tue Apr 18, 2023 3:46 am    Post subject: [solved] smb share setup ignorance Reply with quote

Hello,

I've been for the past months trying on and off to set up access to an smb1 share I have in my router; an endeavour which I haven't managed to surmount because, quite frankly, I have close to no idea of what I'm doing :oops: . By access, I mean accessing the smb1 share through a file manager.

I've tried to follow the gentoo guide on how to setup samba https://wiki.gentoo.org/wiki/Samba/Guide, but that hasn't worke out for me. Maybe my configuration file is wrong? It's pretty much a copy-paste of the wiki:
Code:
[global]
## # Replace MYWORKGROUPNAME with the appropriate workgroup/domain
workgroup = MIGUE
## # Of course this has no REAL purpose other than letting
# everyone knows it is not Windows!
# %v prints the version of Samba being used.
server string = Migue\'s Samba Server %v
## # CUPS will be used; it should be inserted here
printcap name = cups
printing = cups
load printers = yes
## # This line enables the log file and limits its size to less than 50kb.
log file = /var/log/samba/log.%m
max log size = 50
## # We are going to set some options for our interfaces...
#socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
## # This is a good idea, what we are doing is binding the
# samba server to our local network.
# For example, if eth0 is the local network interface:
interfaces = lo eth0 wlp4s0
bind interfaces only = yes
## # Specifies which IP address range is allowed to access Samba
# (this is for added security since this configuration does
# not use passwords):
hosts allow = 127.0.0.1 192.168.1.0/24
hosts deny = 0.0.0.0/0
## # Other options for this are USER, DOMAIN, ADS, and SERVER
# The default is user
security = user
# previously set to share, but this no longer works
## # No passwords will be used so a guest account should be enabled:
guest ok = yes

## # Now set print drivers information:
[print$]
comment = Printer Drivers
path = /etc/samba/printer ## # This path holds the driver structure
guest ok = yes
browseable = yes
read only = yes
## # Modify the following to "<username>,root" to add a second printer admin:
write list = root

## # Now set the printer share. This should be
# browseable, printable, public, etc.:
[printers]
comment = All Printers
browseable = no
printable = yes
writable = no
guest ok = yes
path = /var/spool/samba
## # Modify the following to "<username>,root" to add a second printer admin:
printer admin = migue,root

## # Create a new share that can read from or written to anywhere.
# This is kind of like a temp public share; anyone can do what
# they want here:
[public]
comment = Public Files
browseable = yes
create mode = 0766
guest ok = yes
path = /home/samba/public


After this, I found out that I may be needing a dns to get the share to automatically show up, so I installed net-dns/avahi and added the zeroconf use flag to net-fs/samba. But that still didn't work :( .

Those are only the things I can remember, so I'll leave all the sets and package.use files that I've created:

/etc/portage/sets/network-fs:
Code:
sys-auth/nss-mdns
net-fs/samba
# SMB1 file system
net-fs/smbnetfs
net-nds/smbldap-tools
# Auto-discover
net-dns/avahi

Everything under # SMB1 file system are packages I downloaded just because I found them while using emerge -s smb and eix smb; they weren't found on any of the samba or avahi gentoo articles.

/etc/portage/package.use/samba:
Code:
net-fs/samba cups pam zeroconf
net-fs/samba ldap
net-nds/openldap samba
#For dolphin
kde-apps/kio-extras samba


Maybe the problem lies in avahi's end, because on /usr/bin/avahi-discover I can only see my hostname as a Microsoft Windows Network.

Any help would be appreciated :D


Last edited by mitocram on Sun Apr 23, 2023 4:59 am; edited 1 time in total
Back to top
View user's profile Send private message
stefan11111
l33t
l33t


Joined: 29 Jan 2023
Posts: 921
Location: Romania

PostPosted: Tue Apr 18, 2023 9:59 am    Post subject: Reply with quote

What you are describing is setting up a smb share, not connecting to one.
Can you mount the share manually?
If you want to mount share automatically, you will need fstab entries like this:
Code:
//10.0.15.220/hdd1      /home/user/HDD1       cifs    username=username,password=pass,uid=user,_netdev    0 0

_________________
My overlay: https://github.com/stefan11111/stefan_overlay
INSTALL_MASK="/etc/systemd /lib/systemd /usr/lib/systemd /usr/lib/modules-load.d *udev* /usr/lib/tmpfiles.d *tmpfiles* /var/lib/dbus /usr/bin/gdbus /lib/udev"
Back to top
View user's profile Send private message
mitocram
n00b
n00b


Joined: 03 Jan 2023
Posts: 19

PostPosted: Tue Apr 18, 2023 8:54 pm    Post subject: Reply with quote

stefan11111 wrote:
What you are describing is setting up a smb share, not connecting to one.
Can you mount the share manually?
If you want to mount share automatically, you will need fstab entries like this:
Code:
//10.0.15.220/hdd1      /home/user/HDD1       cifs    username=username,password=pass,uid=user,_netdev    0 0

Hello Stefan,

I haven't been able to connect manually, and I am not looking for a way to automatically mount the share, like with the fstab example you provided, just a way to find the smb share in dolphin's network tab, but thanks anyway; sorry for the confusion :? .

Something very peculiar happens with manual connections though, which I think might be the main culprit of my issues. My local ip is 192.168.0.102, but my localhost name is miguelaptop. I ran smbclient -L on both:
with my ip
Code:
$smbclient -L \\192.168.0.102
protocol negotiation failed: NT_STATUS_INVALID_NETWORK_RESPONSE

with my localhost name
Code:
$smbclient -L miguelaptop
Password for [MIGUE/migue]: *****

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        public          Disk      Public Files
        IPC$            IPC       IPC Service (Migue\'s Samba Server 4.16.9)
SMB1 disabled -- no workgroup available


This might be avahi doing something, I'm not sure, but it seems weird to me anyway. I also ran nmap -p 445 "192.168.0.*", this is the output without the machines with a closed 445 port:
Code:
Starting Nmap 7.93 ( https://nmap.org ) at 2023-04-18 17:20 -03
Nmap scan report for 192.168.0.1
Host is up (0.020s latency).

PORT    STATE SERVICE
445/tcp open  microsoft-ds

Nmap scan report for 192.168.0.102
Host is up (0.00017s latency).

PORT    STATE SERVICE
445/tcp open  microsoft-ds

Nmap scan report for 192.168.0.114
Host is up (0.022s latency).

PORT    STATE    SERVICE
445/tcp filtered microsoft-ds

Nmap done: 256 IP addresses (11 hosts up) scanned in 16.77 seconds


Trying smbclient -L on these ips gives the following errors:

192.168.0.1 (open, router)
Code:
$smbclient -L \\192.168.0.1
protocol negotiation failed: NT_STATUS_CONNECTION_DISCONNECTED


192.168.0.102 (open, my computer)
Code:
$smbclient -L \\192.168.0.102
protocol negotiation failed: NT_STATUS_INVALID_NETWORK_RESPONSE


192.168.0.114 (filtered)
Code:
$smbclient -L \\192.168.0.114
do_connect: Connection to 192.168.0.114 failed (Error NT_STATUS_CONNECTION_REFUSED)


192.168.0.114 doesn't really surprise me, as I have no clue which device this is, nor do I really care. 192.168.0.102 is my computer, but I decided to post the output again anyway; the interesting one, 192.168.0.1, is where I can access the share through other devices, so maybe it's important.



Sorry for the late response, I published the post at around midnight where I live, and just got back home recently. :D
Back to top
View user's profile Send private message
mitocram
n00b
n00b


Joined: 03 Jan 2023
Posts: 19

PostPosted: Sun Apr 23, 2023 5:06 am    Post subject: Reply with quote

I found the issue :D

My local share uses smb1, so I needed to set the value of client min protocol in /etc/samba/smb.conf to NT1, therefore I added client min protocol = NT1 under the global section; now I can find the shares in dolphin :) .
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21522

PostPosted: Sun Apr 23, 2023 3:19 pm    Post subject: Reply with quote

That may have been the immediate solution, but as I read man smb.conf, protocol NT1 is a dialect first shipped in Windows NT. Switching the server to offer a newer SMB dialect may provide a better user experience long term.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum