[SOLVED] SMB share unaccessible
by bennypr0fane from LinuxQuestions.org on (#6HA0S)
I made this SMB share on my Raspberry Pi(RPi OS Lite) for my scanner to be able to send scanned files to it. However, the scans get rejected.
Also, the SMB share is visible in other machines, but I can't login to it using the credentials I specified for the scanner.
See below the contents of my smb.conf:
Code: cat /etc/samba/smb.conf
# I deleted most of the comments
#======================= Global Settings =======================
[global]
workgroup = WORKGROUP
#### Networking ####
; interfaces = 127.0.0.0/8 eth0
; bind interfaces only = yes
#### Debugging/Accounting ####
log file = /var/log/samba/log.%m
log level = 3
max log size = 1000
logging = file
panic action = /usr/share/samba/panic-action %d
####### Authentication #######
server role = standalone server
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
########## Domains ###########
; logon path = \\%N\profiles\%U
; logon drive = H:
# logon home = \\%N\%U
; logon script = logon.cmd
; add user script = /usr/sbin/useradd --create-home %u
; add machine script = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u
; add group script = /usr/sbin/addgroup --force-badname %g
############ Misc ############
; include = /home/samba/etc/smb.conf.%m
; idmap config * : backend = tdb
; idmap config * : range = 3000-7999
; idmap config YOURDOMAINHERE : backend = tdb
; idmap config YOURDOMAINHERE : range = 100000-999999
; template shell = /bin/bash
usershare allow guests = yes
#======================= Share Definitions =======================
[homes]
comment = Home Directories
browseable = no
read only = yes
create mask = 0700
directory mask = 0700
valid users = %S
;[netlogon]
; comment = Network Logon Service
; path = /home/samba/netlogon
; guest ok = yes
; read only = yes
;[profiles]
; comment = Users profiles
; path = /home/samba/profiles
; guest ok = no
; browseable = no
; create mask = 0600
; directory mask = 0700
[printers]
comment = All Printers
browseable = no
path = /var/tmp
printable = yes
guest ok = no
read only = yes
create mask = 0700
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
; write list = root, @lpadmin
[scannershare]
path = /home/ben/Scans
writeable = Yes
create mask = 0777
directory mask = 0777
public = yes
guest ok = yes
only guest = noTo set up the share, I followed a synthesis of some tutorials:
tut1, tut2 and tut3
the scanners user is xeroxb225:
Code:sudo smbpasswd -a xeroxb225The user does seem to exist:
Code:# on server
~ $ sudo pdbedit -L
added interface eth0 ip=192.168.178.4 bcast=192.168.178.255 netmask=255.255.255.0
xeroxb225:1002:XeroxB225
# on client
~ $ smbclient -L raspi4 -U xeroxb225
Password for [SAMBA\xeroxb225]:
Sharename Type Comment
--------- ---- -------
print$ Disk Printer Drivers
scannershare Disk
IPC$ IPC IPC Service (Samba 4.17.12-Debian)
xeroxb225 Disk Home Directories
SMB1 disabled -- no workgroup availableI confirmed that the scanner supports SMB v3.
It hasn't become clear to me from the tutorials if the SMB user has to be the (Linux-) owner of the shared folder - in the tutorials, it's always `pi` for both. Wouldn't make sense to me though as it would mean each share could only ever be accessed be a single user.
Currently, the shared folder is owned by Linux user `ben`:
Code:ben@raspi4:~ $ ls -l
total 12
drwxr-xr-x 3 ben ben 4096 Dec 9 23:30 FTP
drwxrwxrwt 2 ben ben 4096 Dec 15 20:59 Scans
-rw-r--r-- 1 ben ben 17 Dec 10 00:44 test.txt
Also, the SMB share is visible in other machines, but I can't login to it using the credentials I specified for the scanner.
See below the contents of my smb.conf:
Code: cat /etc/samba/smb.conf
# I deleted most of the comments
#======================= Global Settings =======================
[global]
workgroup = WORKGROUP
#### Networking ####
; interfaces = 127.0.0.0/8 eth0
; bind interfaces only = yes
#### Debugging/Accounting ####
log file = /var/log/samba/log.%m
log level = 3
max log size = 1000
logging = file
panic action = /usr/share/samba/panic-action %d
####### Authentication #######
server role = standalone server
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
########## Domains ###########
; logon path = \\%N\profiles\%U
; logon drive = H:
# logon home = \\%N\%U
; logon script = logon.cmd
; add user script = /usr/sbin/useradd --create-home %u
; add machine script = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u
; add group script = /usr/sbin/addgroup --force-badname %g
############ Misc ############
; include = /home/samba/etc/smb.conf.%m
; idmap config * : backend = tdb
; idmap config * : range = 3000-7999
; idmap config YOURDOMAINHERE : backend = tdb
; idmap config YOURDOMAINHERE : range = 100000-999999
; template shell = /bin/bash
usershare allow guests = yes
#======================= Share Definitions =======================
[homes]
comment = Home Directories
browseable = no
read only = yes
create mask = 0700
directory mask = 0700
valid users = %S
;[netlogon]
; comment = Network Logon Service
; path = /home/samba/netlogon
; guest ok = yes
; read only = yes
;[profiles]
; comment = Users profiles
; path = /home/samba/profiles
; guest ok = no
; browseable = no
; create mask = 0600
; directory mask = 0700
[printers]
comment = All Printers
browseable = no
path = /var/tmp
printable = yes
guest ok = no
read only = yes
create mask = 0700
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
; write list = root, @lpadmin
[scannershare]
path = /home/ben/Scans
writeable = Yes
create mask = 0777
directory mask = 0777
public = yes
guest ok = yes
only guest = noTo set up the share, I followed a synthesis of some tutorials:
tut1, tut2 and tut3
the scanners user is xeroxb225:
Code:sudo smbpasswd -a xeroxb225The user does seem to exist:
Code:# on server
~ $ sudo pdbedit -L
added interface eth0 ip=192.168.178.4 bcast=192.168.178.255 netmask=255.255.255.0
xeroxb225:1002:XeroxB225
# on client
~ $ smbclient -L raspi4 -U xeroxb225
Password for [SAMBA\xeroxb225]:
Sharename Type Comment
--------- ---- -------
print$ Disk Printer Drivers
scannershare Disk
IPC$ IPC IPC Service (Samba 4.17.12-Debian)
xeroxb225 Disk Home Directories
SMB1 disabled -- no workgroup availableI confirmed that the scanner supports SMB v3.
It hasn't become clear to me from the tutorials if the SMB user has to be the (Linux-) owner of the shared folder - in the tutorials, it's always `pi` for both. Wouldn't make sense to me though as it would mean each share could only ever be accessed be a single user.
Currently, the shared folder is owned by Linux user `ben`:
Code:ben@raspi4:~ $ ls -l
total 12
drwxr-xr-x 3 ben ben 4096 Dec 9 23:30 FTP
drwxrwxrwt 2 ben ben 4096 Dec 15 20:59 Scans
-rw-r--r-- 1 ben ben 17 Dec 10 00:44 test.txt