Score:3

Trying to SAMBA share a folder always gives errors

kr flag
AJ.

I've been trying to figure out why this issue is occurring every single time. I've tried searching for solution for this issue but have come up with nought. Can you help me identify and fix the error:

My issue initially started out with trying to share with Samba Shares. I am booting an old Levovo laptop (E420) using an Ubuntu live USB. The laptop boots up fine, it is connected to the Internet (I am posting this question from the laptop). The laptop is connected to my LAN through an Ethernet cable. I am trying to share the local HDD of the Laptop on the network to transfer all the files out of the laptop to another device. However, when I mount the local HDD in fIles and then try to share it (Right Click -> Network Share), I get the following error. How do I fix it and share the folder on the network?

Share error screenshot

There are two errors that I can see:

  1. An attempt to create a log.net file for which the user does not seem to have permission. I'm not sure why that is. I have even created an empty file with the log.net and given all permissions to everyone for it (i.e. chmod 777)
  2. The error says that I'm using an invalid character in the share name. But I'm not. I've even tried a different "name" but this error persists.

For reference, the error text is also pasted below:

'net usershare' returned error 255: [2023/04/05 09:28:20, 0] ../../lib/util/debug.c:1100(reopen_one_log) reopen_one_log: Unable to open new log file 'AJ/log.net': No such file or directory net usershare add: share name /media/ubuntu/e42804db2804af1c/aj contains invalid characters (any of %<>*?|/+=;:",)

David avatar
cn flag
Most likely it is trying to make the log file on the USB and of course it can not.
AJ. avatar
kr flag
AJ.
Hi David, The path that it's trying to create the file in is in the folder I'm trying to share: 'AJ/log.net'. Does this exist on the USB drive? And why is the USB drive not writable for this file?
David avatar
cn flag
If it is a Live Media boot USB it is not available to write any files. It is closed to write.
Score:3
br flag

Hey I was having the same problem when using the graphic interface in Nautilus and turns out it was a bug in nautilus-share https://bugs.launchpad.net/ubuntu/+source/nautilus-share/+bug/1967245.

I understand that the problem is the use of the -l parameter called by the nautilus extension that sets up the folder to be shared, with --long parameter it works fine. So, you can do it from the terminal:

net usershare add --long share <full_path> "comment" "Everyone:R" guest_ok=n

(Change R to F for read-write permissions) Notice that the way this is set up you still need to create a user and pass to access the samba server: sudo smbpasswd -a <some_user_name> and restart the service: sudo systemctl restart smbd .

The original source was: https://forum.manjaro.org/t/samba-nautilus-share-funktioniert-nicht-mehr/85428/20

Nihal Sharma avatar
ng flag
sudo smbpasswd -a nihal New SMB password: Retype new SMB password: Failed to add entry for user nihal. getting this error
Score:0
iq flag

You have a problem with the log file path and share name, here is how to fix that, first we fix the log file path here, open this file /etc/samba/smb.conf then search for a line that start with log file and change it so that it look like that log file = /var/log/samba/log.%m then check that the path specified by your system for the log file exist and have the proper permission

sudo mkdir -p /var/log/samba
sudo chown root:adm /var/log/samba
sudo chmod 750 /var/log/samba

for the share name it should not contain any of those character % < > * ? | / + = ; : , " and there is / in /media/ubuntu/e42804db2804af1c/aj just use something like aj or test if is temporary, then restart properly and it should work. sudo systemctl restart smbd nmbd

edit: following your comment the problem might be related to the way the GUI is creating the share name, here what you can do, first check the permission for example for /media/ubuntu/e42804db2804af1c/aj we do ( replace your_username with yours )

sudo chown -R your_username:your_username /media/ubuntu/e42804db2804af1c/aj
sudo chmod -R 755 /media/ubuntu/e42804db2804af1c/aj

then in /etc/samba/smb.conf add those ( replace your_username and path with yours )

[aj]
   path = /media/ubuntu/e42804db2804af1c/aj
   browseable = yes
   read only = no
   guest ok = yes
   create mask = 0644
   directory mask = 0755
   force user = your_username

save and restart sudo systemctl restart smbd nmbd

AJ. avatar
kr flag
AJ.
Thank you. I have followed the steps you have outlined. The folder /var/log/samba already exists and it also has a few files such as log.smbd, log.nmbd etc. For the share name, I am only entering aj or something similar. I'm not sure where the slash is coming from. I'm using the GUI to create a share and am entering the share name exactly as it is in the screenshot. How do I prevent the errant / from coming in (I don't know why or how it is even coming in)
Saxtheowl avatar
iq flag
You welcome, I updated my answer.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.