No access on Samba share using Kubuntu 19.04 GUI
I have two machines running Kubuntu 19.04 and have troubles sharing files using KDE GUI. These are the steps I did to share a folder for a specific user (lets name him myuser
) for read and write access:
- On the machine A, I right-clicked a folder named "transfer", selected properties and then selected share. Since the system A was freshly installed, samba was not. The tab offered to installed it, which i did. Then I was able to select to share via samba in the tab.
- I added the user
myuser
on the machine A, which matches exactly the user on machine B. - I selected to share the folder with samba and
allowed guest access to
myuser
andeveryone
with read and write access - With machine B, I navigated to the machine A samba shares. The folder "transfer" was visible. When I open it, a user/passwort prompt comes
up. But whatever I enter into that prompt, access is denied. Using
myuser
, leaving everythin blank or the owning user of machine A - same result. -
I then added a samba user on machine a using
sudo smbpasswd -a myuser
and entered the exact same password which exists on machines A and B. Still the same result.
Then i added
min protocol = SMB3
to my/etc/samba/smb.conf
. Still the same result.
What am I missing?
This is the global part of my smb.conf:
[global]
## Browsing/Identification ###
# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup = WORKGROUP
# server string is the equivalent of the NT Description field
server string = %h server (Samba, Ubuntu)
# Disable SMB1 and SMB2
min protocol = SMB3
Edit: This is the output of sudo net usershare info --long
(at the Moment "Everyone" has only read access, HTPC
is the name of machine A):
[Transfer]
path=/media/media/6TB 2/Transfer
comment=
usershare_acl=Everyone:R,HTPC\myuser:F,guest_ok=y
Edit: Output of ls -al "/media/media/6TB 2"
insgesamt 333
drwxrwxrwx 1 media media 8192 Apr 21 14:48 .
drwxr-x---+ 3 root root 4096 Apr 22 07:43 ..
drwxrwxrwx 1 media media 4096 Dez 15 12:44 '$RECYCLE.BIN'
drwxrwxrwx 1 media media 0 Apr 20 12:39 Aufnahmen
drwxrwxrwx 1 media media 262144 Apr 19 15:40 Aufnahmen_win
drwxrwxrwx 1 media media 4096 Okt 1 2014 Dokumentationen
drwxrwxrwx 1 media media 12288 Okt 3 2018 Downloads
drwxrwxrwx 1 media media 0 Apr 21 15:58 'Kopie Backup'
-rwxrwxrwx 1 media media 435 Dez 19 17:36 mountBackup.bat
drwxrwxrwx 1 media media 0 Jan 6 2016 'System Volume Information'
drwxrwxrwx 1 media media 12288 Apr 19 17:10 Transfer
Solution 1:
One way to solve this issue is to edit /etc/samba/smb.conf and right below the workgroup = WORKGROUP
line add this one:
force user = media
Then restart smbd:
sudo service smbd restart
Reason:
The second "media" in the path /media/media is a user name and it has permissions of: drwxr-x---+ 3 root root 4096 Apr 22 07:43 ..
. The "+" at the end of those permissions indicates an extended permissions attribute that Linux automatically assigns for all local login users. It's real permissions look like this:
$ getfacl /media/media
getfacl: Removing leading '/' from absolute path names
# file: media/media
# owner: root
# group: root
user::rwx
user:media:r-x
group::---
mask::r-x
other::---
Linux creates it that way as a security / privacy thing in that only root and that specific user has the right to traverse that folder in order to get to any folder under it. A "guest" user or "myuser" is not the "media" user so they will never get to the Transfer folder.
Once samba allows the client user access they will be converted to the media user through the "force user = media" directive allowing them to get to the subfolder.