Can't write to samba share

Hello everybody,

I am trying to conduct Samba sharing between 2 Manjaro XFCE systems. I want to be able to mainly write on computer A from computer B. The reason is, the HDD on computer B has got corrupted and I have to recover some important files from it. I have to use Photorec on computer B and select computer A as the destination where Photorec can save the recovered files.

I have connected both systems with Ethernet directly without using any router. I do have router but, since the two computers got connected readily without it and computer A is readable and browsable from computer B, I thought why unnecessarily increase another hardware layer. The Samba-share on computer A is visible from computer B. I can browse through folders. I can read files. However, I can not write to that folder from computer B.

I did the following editing to the file /etc/samba/smb.conf on computer A. Inserted the below, inside the /etc/samba/smb.conf file at the end of that file.

[MySambaShare]
comment = My Samba share
path = /samba
writable = yes
browseable = no
create mask = 0700
directory mask = 0700
read only = no
guest ok = no

After doing this, I issued the following commands on computer A;

$ sudo systemctl stop samba
$ sudo groupadd -r sambausers
$ sudo usermod -aG sambausers Username
$ sudo smbpasswd -a Username
New SMB password:
Retype new SMB password:
Added user Username.
$ sudo mkdir /samba
$ sudo chown -R :sambausers /samba
$ sudo chmod 1770 /samba
$ sudo systemctl enable --now smb
$ sudo systemctl enable --now nmb
$ sudo systemctl restart smb.service
$ systemctl status smb
● smb.service - Samba SMB Daemon
Loaded: loaded (/usr/lib/systemd/system/smb.service; enabled; vendor prese>
Active: active (running) since Sun 2021-04-11 16:16:57 IST; 1h 6min ago
Docs: man:smbd(8)
man:samba(7)
man:smb.conf(5)
Main PID: 966 (smbd)
Status: “smbd: ready to serve connections…”
Tasks: 4 (limit: 4405)
Memory: 17.7M
CGroup: /system.slice/smb.service
├─ 966 /usr/bin/smbd --foreground --no-process-group
├─1011 /usr/bin/smbd --foreground --no-process-group
├─1012 /usr/bin/smbd --foreground --no-process-group
└─1095 /usr/bin/smbd --foreground --no-process-group

Apr 11 16:16:51 xxxxxxxxxx systemd[1]: Starting Samba SMB Daemon…
Apr 11 16:16:57 xxxxxxxxxx systemd[1]: Started Samba SMB Daemon.
Apr 11 16:16:57 xxxxxxxxxx smbd[966]: [2021/04/11 16:16:57.624279, 0] …/…/li>
Apr 11 16:16:57 xxxxxxxxxx smbd[966]: daemon_ready: daemon ‘smbd’ finished st>
lines 1-20/20 (END)

$ systemctl status nmb
● nmb.service - Samba NMB Daemon
Loaded: loaded (/usr/lib/systemd/system/nmb.service; enabled; vendor prese>
Active: active (running) since Sun 2021-04-11 16:16:51 IST; 1h 6min ago
Docs: man:nmbd(8)
man:samba(7)
man:smb.conf(5)
Main PID: 687 (nmbd)
Status: “nmbd: ready to serve connections…”
Tasks: 1 (limit: 4405)
Memory: 16.7M
CGroup: /system.slice/nmb.service
└─687 /usr/bin/nmbd --foreground --no-process-group

Apr 11 16:16:26 xxxxxxxxxx nmbd[687]: NOTE: NetBIOS name resolution is not su>
Apr 11 16:16:51 xxxxxxxxxx nmbd[687]: [2021/04/11 16:16:51.826402, 0] …/…/li>
Apr 11 16:16:51 xxxxxxxxxx nmbd[687]: daemon_ready: daemon ‘nmbd’ finished st>
Apr 11 16:16:51 xxxxxxxxxx systemd[1]: Started Samba NMB Daemon.
Apr 11 16:17:14 xxxxxxxxxx nmbd[687]: [2021/04/11 16:17:14.855452, 0] …/…/so>
Apr 11 16:17:14 xxxxxxxxxx nmbd[687]: *****
Apr 11 16:17:14 xxxxxxxxxx nmbd[687]:
Apr 11 16:17:14 xxxxxxxxxx nmbd[687]: Samba name server xxxxxxxxxx is now a l>
Apr 11 16:17:14 xxxxxxxxxx nmbd[687]:
Apr 11 16:17:14 xxxxxxxxxx nmbd[687]: *****
lines 1-23…skipping…
● nmb.service - Samba NMB Daemon
Loaded: loaded (/usr/lib/systemd/system/nmb.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2021-04-11 16:16:51 IST; 1h 6min ago
Docs: man:nmbd(8)
man:samba(7)
man:smb.conf(5)
Main PID: 687 (nmbd)
Status: “nmbd: ready to serve connections…”
Tasks: 1 (limit: 4405)
Memory: 16.7M
CGroup: /system.slice/nmb.service
└─687 /usr/bin/nmbd --foreground --no-process-group

Apr 11 16:16:26 xxxxxxxxxx nmbd[687]: NOTE: NetBIOS name resolution is not supported for Internet Protocol Version 6 (IPv6).
Apr 11 16:16:51 xxxxxxxxxx nmbd[687]: [2021/04/11 16:16:51.826402, 0] …/…/lib/util/become_daemon.c:135(daemon_ready)
Apr 11 16:16:51 xxxxxxxxxx nmbd[687]: daemon_ready: daemon ‘nmbd’ finished starting up and ready to serve connections
Apr 11 16:16:51 xxxxxxxxxx systemd[1]: Started Samba NMB Daemon.
Apr 11 16:17:14 xxxxxxxxxx nmbd[687]: [2021/04/11 16:17:14.855452, 0] …/…/source3/nmbd/nmbd_become_lmb.c:398(become_local_master_st>
Apr 11 16:17:14 xxxxxxxxxx nmbd[687]: *****
Apr 11 16:17:14 xxxxxxxxxx nmbd[687]:
Apr 11 16:17:14 xxxxxxxxxx nmbd[687]: Samba name server xxxxxxxxxx is now a local master browser for workgroup WORKGROUP on subnet 1>
Apr 11 16:17:14 xxxxxxxxxx nmbd[687]:
Apr 11 16:17:14 xxxxxxxxxx nmbd[687]: *****
~
~
~
~
~
~
~
~
~
~
~
lines 1-23/23 (END)

$ testparm
Load smb config files from /etc/samba/smb.conf
lp_load_ex: Max protocol NT1 is less than min protocol SMB2.
Loaded services file OK.
Weak crypto is allowed
Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

#Global parameters
[global]
client min protocol = SMB2
dns proxy = No
log file = /var/log/samba/%m.log
map to guest = Bad Password
max log size = 1000
name resolve order = lmhosts bcast host wins
obey pam restrictions = Yes
pam password change = Yes
passwd chat = NewUNIXpassword %n\n ReTypenewUNIXpassword* %n\n passwd:allauthenticationtokensupdatedsuccessfully*
passwd program = /usr/bin/passwd %u
security = USER
server min protocol = SMB3
server role = standalone server
unix password sync = Yes
usershare allow guests = Yes
usershare max shares = 100
usershare path = /var/lib/samba/usershare
idmap config * : backend = tdb
force create mode = 0070
force directory mode = 0070

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

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

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

[MySambaShare]
browseable = No
comment = My Samba share
create mask = 0700
directory mask = 0700
path = /samba
read only = No

I did not do anything on the computer B which is booted from the Manjaro OS installed on the USB. It simply readily got connected and the Samba-share on computer A is readable and browsable and I had to do nothing. It is just not letting write on the computer A from computer B.

Kindly throw some light over why this is happening and how I could resolve this issue.

Any efforts towards this is greatly appreciated.

Thanks and warm regards.

How?
Via a router from which they get their IP by dhcp?
You’d need to describe and share your configuration on both machines.
Else all people can do is guess - which is ineffective and next to useless.

This has probably been asked already:
Why in the world would you want to use samba to share files between two linux machines?

well, it’s good to have it set up in case you want or need to share with a windows machine

Sorry @Nachlese, for the delay in replying and thanks for the helping hand.

I regret not having given adequate information in the original post. I will edit the first post and provide the information suggested by you. Please let me know if I need to provide any more info.

It is mysterious that both the systems get connected readily and Samba-share on computer A is readable and browsable from computer B but is not writable. Please kindly through some light over this issue.

Thanks and warm regards.

I can only give some hints from memory - it is years ago that I casually used samba.

B can’t write to A
the reason must be the configuration on A

maybe the permissions with which you created the /samba directory

$ sudo systemctl stop samba
$ sudo groupadd -r sambausers
$ sudo usermod -aG sambausers Username
$ sudo smbpasswd -a Username

Is this referring to the username on B also?
The one who want’s to write but can’t?

also, the “browsable = no” in the share definition seems odd
But this is just my intuition and it has been a long time since I used samba - I did not look at any manuals to verify.

Is there nothing in the system logs?
Perhaps samba can be run with more verbose settings to see what is going on and why the write to A fails.

That is about all I can say - and almost all of it is based not on knowledge but on speculation. :wink:

you can try sudo chown -R USER.GROUP /samba and sudo chown -R ug+rw /samba Where USER is a specific username and GROUP is a specific user.That should give the folder read write.