Dear all, I tried to share a folder under /home/nicholaswkc/Window_Share
sudo chmod 0775 /home/nicholaswkc/Window_Share
sudo semanage fcontext -a -t samba_share_t "/home/nicholaswkc/Window_Share(/.*)?"
sudo restorecon -Rv /home/nicholaswkc/Window_Share
/etc/samba/smb.conf
[shared]
comment = Alma Linux Samba Share
path = /home/nicholaswkc/Window_Share
browseable = yes
writable = yes
guest ok = yes
valid users = @samba_usr
create mask = 0664
directory mask = 0775
sudo groupadd samba_users
sudo useradd -M -s /sbin/nologin smbuser1
sudo usermod -aG samba_users smbuser1
sudo chgrp samba_users /srv/samba/shared
sudo smbpasswd -a smbuser1
sudo firewall-cmd --permanent --add-service=samba
sudo firewall-cmd --reload
sudo systemctl enable --now smb nmb
This is what I have done.
Then, I tried to access it in the alma linux same machine.
smb://127.0.0.1/shared i enter the smbuser1 and password but it fails to connect.
Anyone know what went wrong?
Hello.
Could it be a mistake in the group name in the valid users section of smb.conf (a mismatch between samba_usr and samba_users)?
[shared]
comment=Alma Linux Samba Shared
path=/home/nicholaswkc/Window_Share
browseable=yes
writable=yes
guest ok=yes
valid users=@smbusr
create mask=0664
directory mask=0775
sudo chmod 0775 /home/nicholaswkc/Window_Share
sudo semanage fcontext -a -t samba_share_t “/home/nicholaswkc/Window_Share(/.*)?”
sudo groupadd smbgrp
sudo useradd -M -s /sbin/nologin smbusr
sudo usermod -aG smbgrp smbusr
sudo chgrp smbgrp /home/nicholaswkc/Window_Share/
sudo smbpasswd -a smbusr
Then, I tried access smb://127.0.0.1 which i can access but cannot access using smb://127.0.0.1/shared (On same machine) where it keep prompting login window. I enter the smbusr and password correctly.
I edited the file samba.conf using sudo. I added firewall and selinux already. What could be wrong this time?
Please help. Thanks a lot.
Hello,
I think the problem may be this line:
valid users = @smbusr
In Samba, @ means a group, not a user.
But in your example, smbusr is the user name, and the group you created is smbgrp.
So this should probably be either:
valid users = smbusr
or, if you want to allow the group:
valid users = @smbgrp
That looks like the first thing to fix.
Also, since your share is under /home, it may be worth testing with a simpler path like /srv/samba/shared first, just to rule out any SELinux or home-directory related issues.
After updating smb.conf, please also run testparm and then try:
smbclient -L localhost -U smbusr
and
smbclient //localhost/shared -U smbusr
So, at least from what you posted, the most likely issue is that valid users is pointing to the wrong name.
[shared]
comment=Alma Linux Samba Shared
path=/srv/samba/
browseable=yes
writable=yes
guest ok=yes
valid users=@smbgrp
create mask=0664
directory mask=0775
sudo mkdir -p /srv/samba/
sudo chown -R nobody:nobody /srv/samba
sudo chcon -t samba_share_t /srv/samba
sudo chcon -t samba_share_t /srv/samba
When i running this coomand,
smbclient -L localhost -U smbusr
Sharename Type Comment
--------- ---- -------
print$ Disk Printer Drivers
shared Disk Alma Linux Samba Shared
IPC$ IPC IPC Service (Samba 4.22.4)
smbusr Disk Home Directories
SMB1 disabled – no workgroup available
When running this command,
smbclient //localhost/shared -U smbusr
Try “help” to get a list of possible commands.
smb: >
A billion thanks for your help. Appreciate it.
Hello,
I think the main problem is this line:
valid users = @smbusr
@smbusr means a group, not the user smbusr.
So please change it to either:
valid users = smbusr
or, if you want to use the group:
valid users = @smbgrp
Also, because the share is under /home/..., the parent directory permissions may also block Samba access.
Thanks.
The smbclient prompt in post 5 confirms the configuration is working — great progress.
One thing worth checking before you close this out: the ownership on `/srv/samba/`. The `chown -R nobody:nobody` sets the directory as owned by the system guest account. For writable authenticated access by `smbusr`/`smbgrp` members, you want:
```
sudo chown -R root:smbgrp /srv/samba
sudo chmod 0770 /srv/samba
```
With `nobody:nobody` ownership, group members may hit permission errors on writes depending on the `create mask` setting in `smb.conf`.
Also, if you ran `chcon -t samba_share_t /srv/samba` without `restorecon -R`, the SELinux context applied to the directory itself but not necessarily to files created inside it later. Running `sudo restorecon -Rv /srv/samba` after setting the policy is the cleaner approach.
For the original GUI access (`smb://127.0.0.1/shared` in the file manager) — if smbclient works from the command line, the file manager should work too once you enter your credentials. The “SMB1 disabled” message is completely normal on AlmaLinux 10. Should sort you out.