Hi people.
I'm running Samba on Fedora 31. It's working great.
I want to share a USB drive using Samba. I've tried mounting it to a directory within a Samba share and it does work due to permission errors.
- I create the mount directory (USB) as a normal user, thus giving it "normal" permissions. Fore test purposes, I can r/w/x files to this directory with no problems.
- I mount the USB device to the mount directory using mount /dev/sdb1 USB.
- I can access the USB directory from the server and r/w/x everything just fine.
- When I try to access the share/USB directory from the client, like Dolphin, it requests permission in the form of user and password. The user and password that I use to access the share do not work. Nor does the user and password I use to access the server.
What am I missing ?
How does one share a USB device via Samba ?
Thanks
On Mon, 25 Nov 2019 at 14:59, linux guy linuxguy123@gmail.com wrote:
Hi people.
I'm running Samba on Fedora 31. It's working great.
I want to share a USB drive using Samba. I've tried mounting it to a directory within a Samba share and it does work due to permission errors.
- I create the mount directory (USB) as a normal user, thus giving it
"normal" permissions. Fore test purposes, I can r/w/x files to this directory with no problems.
- I mount the USB device to the mount directory using mount /dev/sdb1
USB.
- I can access the USB directory from the server and r/w/x everything just
fine.
- When I try to access the share/USB directory from the client, like
Dolphin, it requests permission in the form of user and password. The user and password that I use to access the share do not work. Nor does the user and password I use to access the server.
What am I missing ?
How does one share a USB device via Samba ?
Have you checked to see if selinux is causing the permission denied issues? See https://fedoraproject.org/wiki/SELinux/samba
I never thought of selinux causing the issue. I'm not getting an selinux error ?
I did a setsebool -P samba_enable_home_dirs on
I can't see why selinux would disallow remote users to access a device mounted to a shared directory. Am I wrong ?
On Mon, Nov 25, 2019 at 2:17 PM George N. White III gnwiii@gmail.com wrote:
On Mon, 25 Nov 2019 at 14:59, linux guy linuxguy123@gmail.com wrote:
Hi people.
I'm running Samba on Fedora 31. It's working great.
I want to share a USB drive using Samba. I've tried mounting it to a directory within a Samba share and it does work due to permission errors.
- I create the mount directory (USB) as a normal user, thus giving it
"normal" permissions. Fore test purposes, I can r/w/x files to this directory with no problems.
- I mount the USB device to the mount directory using mount /dev/sdb1
USB.
- I can access the USB directory from the server and r/w/x everything
just fine.
- When I try to access the share/USB directory from the client, like
Dolphin, it requests permission in the form of user and password. The user and password that I use to access the share do not work. Nor does the user and password I use to access the server.
What am I missing ?
How does one share a USB device via Samba ?
Have you checked to see if selinux is causing the permission denied issues? See https://fedoraproject.org/wiki/SELinux/samba
-- George N. White III
users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
On Mon, 25 Nov 2019 at 18:06, linux guy linuxguy123@gmail.com wrote:
I never thought of selinux causing the issue. I'm not getting an selinux error ?
Where did you look? You can use "sudo ausearch -m avc" to show the log entries.
http://homepage.smc.edu/morgan_david//linux/selinux-demonstration.pdf explains that selinux is about what programs are allowed to do.
https://wiki.gentoo.org/wiki/SELinux/Tutorials/Where_to_find_SELinux_permiss... might be useful.
https://fedoraproject.org/wiki/SELinux/samba is "man 8 selinux_samba" which used to come in selinux-policy-devel but dnf can't find it for Fedora 31.
I did a setsebool -P samba_enable_home_dirs on
I can't see why selinux would disallow remote users to access a device mounted to a shared directory. Am I wrong ?
The link I provides says "If you want to share files other than home directories, those files must be labeled samba_share_t." When I created a new samba share in Fedora 60 I had to label the files.
If your external drive uses a low-rent filesystem you may not be able label files.
On Mon, Nov 25, 2019 at 2:17 PM George N. White III gnwiii@gmail.com wrote:
On Mon, 25 Nov 2019 at 14:59, linux guy linuxguy123@gmail.com wrote:
Hi people.
I'm running Samba on Fedora 31. It's working great.
I want to share a USB drive using Samba. I've tried mounting it to a directory within a Samba share and it does work due to permission errors.
- I create the mount directory (USB) as a normal user, thus giving it
"normal" permissions. Fore test purposes, I can r/w/x files to this directory with no problems.
- I mount the USB device to the mount directory using mount /dev/sdb1
USB.
- I can access the USB directory from the server and r/w/x everything
just fine.
- When I try to access the share/USB directory from the client, like
Dolphin, it requests permission in the form of user and password. The user and password that I use to access the share do not work. Nor does the user and password I use to access the server.
What am I missing ?
How does one share a USB device via Samba ?
Have you checked to see if selinux is causing the permission denied issues? See https://fedoraproject.org/wiki/SELinux/samba
-- George N. White III
--
George N. White III
I did the following: sudo setsebool -P samba_export_all_rw on.
This should allow read/write to any directory without using samba_share_t.
I get the same behavior. I can mount the drive to a shared directory and read it on the server, but not on the client. I don't get a permissions error. The directory just appears empty on the client.
On Mon, Nov 25, 2019 at 6:42 PM George N. White III gnwiii@gmail.com wrote:
On Mon, 25 Nov 2019 at 18:06, linux guy linuxguy123@gmail.com wrote:
I never thought of selinux causing the issue. I'm not getting an selinux error ?
Where did you look? You can use "sudo ausearch -m avc" to show the log entries.
http://homepage.smc.edu/morgan_david//linux/selinux-demonstration.pdf explains that selinux is about what programs are allowed to do.
https://wiki.gentoo.org/wiki/SELinux/Tutorials/Where_to_find_SELinux_permiss... might be useful.
https://fedoraproject.org/wiki/SELinux/samba is "man 8 selinux_samba" which used to come in selinux-policy-devel but dnf can't find it for Fedora 31.
I did a setsebool -P samba_enable_home_dirs on
I can't see why selinux would disallow remote users to access a device mounted to a shared directory. Am I wrong ?
The link I provides says "If you want to share files other than home directories, those files must be labeled samba_share_t." When I created a new samba share in Fedora 60 I had to label the files.
If your external drive uses a low-rent filesystem you may not be able label files.
On Mon, Nov 25, 2019 at 2:17 PM George N. White III gnwiii@gmail.com wrote:
On Mon, 25 Nov 2019 at 14:59, linux guy linuxguy123@gmail.com wrote:
Hi people.
I'm running Samba on Fedora 31. It's working great.
I want to share a USB drive using Samba. I've tried mounting it to a directory within a Samba share and it does work due to permission errors.
- I create the mount directory (USB) as a normal user, thus giving it
"normal" permissions. Fore test purposes, I can r/w/x files to this directory with no problems.
- I mount the USB device to the mount directory using mount /dev/sdb1
USB.
- I can access the USB directory from the server and r/w/x everything
just fine.
- When I try to access the share/USB directory from the client, like
Dolphin, it requests permission in the form of user and password. The user and password that I use to access the share do not work. Nor does the user and password I use to access the server.
What am I missing ?
How does one share a USB device via Samba ?
Have you checked to see if selinux is causing the permission denied issues? See https://fedoraproject.org/wiki/SELinux/samba
-- George N. White III
--
George N. White III
users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
On 2019-11-26 02:58, linux guy wrote:
Hi people.
I'm running Samba on Fedora 31. It's working great.
I want to share a USB drive using Samba. I've tried mounting it to a directory within a Samba share and it does work due to permission errors.
I create the mount directory (USB) as a normal user, thus giving it "normal" permissions. Fore test purposes, I can r/w/x files to this directory with no problems.
I mount the USB device to the mount directory using mount /dev/sdb1 USB.
I can access the USB directory from the server and r/w/x everything just fine.
When I try to access the share/USB directory from the client, like Dolphin, it requests permission in the form of user and password. The user and password that I use to access the share do not work. Nor does the user and password I use to access the server.
What am I missing ?
How does one share a USB device via Samba ?
I am not really a "samba" person since we're Linux centric and rely on nfs and sshfs.
But I had a few moments and I did get a version of what I think you want to accomplish working.
The first thing is that my USB drive is an 8GB stick with one partition defined and formatted as ext4. The mount point for the drive is in the userspace and a chown was done on the mounted drive to ensure it was owned by the user.
[egreshko@f31k ~]$ ll -d flash drwxr-xr-x. 3 egreshko egreshko 4096 Nov 26 14:56 flash
And df shows...
/dev/sda1 7653064 17232 7227360 1% /home/egreshko/flash
The smb.conf is rather simple
[global] workgroup = ASIA security = user
passdb backend = tdbsam
[homes] comment = Home Directories valid users = %S, %D%w%S browseable = Yes read only = No inherit acls = Yes
Now, when connected to the home share I did so first with the drive *not* mounted. I was able to exercise the contents of the flash directory just like the any directory of the user.
When I mounted the drive the flash directory became inaccessible.
I noted....
[egreshko@f31k ~]$ ls -dZ /home/egreshko/flash system_u:object_r:unlabeled_t:s0 /home/egreshko/flash
So I did
[egreshko@f31k ~]$ restorecon /home/egreshko/flash [egreshko@f31k ~]$ ls -dZ /home/egreshko/flash system_u:object_r:user_home_t:s0 /home/egreshko/flash
And now it works OK..
[egreshko@meimei ~]$ smbclient //f31k/egreshko -U egreshko Unable to initialize messaging context Enter SAMBA\egreshko's password: Try "help" to get a list of possible commands. smb: > cd flash smb: \flash> ls . D 0 Tue Nov 26 14:56:57 2019 .. D 0 Wed Nov 27 08:57:54 2019 x N 0 Tue Nov 26 14:56:57 2019
7653064 blocks of size 1024. 7227360 blocks available smb: \flash> put wayne putting file wayne as \flash\wayne (11.2 kb/s) (average 11.2 kb/s) smb: \flash> ls . D 0 Wed Nov 27 08:59:38 2019 .. D 0 Wed Nov 27 08:57:54 2019 wayne A 161 Wed Nov 27 08:59:38 2019 x N 0 Tue Nov 26 14:56:57 2019
7653064 blocks of size 1024. 7227352 blocks available smb: \flash>
And, just checking on the server....
[egreshko@f31k flash]$ pwd /home/egreshko/flash [egreshko@f31k flash]$ ll total 24 drwx------. 2 root root 16384 Oct 7 18:51 lost+found -rwxr--r--. 1 egreshko egreshko 161 Nov 27 08:59 wayne -rw-rw-r--. 1 egreshko egreshko 0 Nov 26 14:56 x