Unable to connect to samba shared folder via windows

7,873

Solution 1

If you are using SELinux you need to run this command as root:

chcon -t samba_share_t /home/Shared_folder

Solution 2

if you got error chcon: can't apply partial context to unlabeled file '/home/Shared_folder', using full label for directory. because this directory dosen`t have any label, so it cant get a partial label.(you can see current label with ls -Z).
use below command to set full label for it:

chcon -h system_u:object_r:samba_share_t /home/Shared_folder
chcon -R -h system_u:object_r:samba_share_t /home/Shared_folder*
Share:
7,873

Related videos on Youtube

AJsStack
Author by

AJsStack

Updated on September 18, 2022

Comments

  • AJsStack
    AJsStack over 1 year

    im new to linux and Samba.

    Aim

    Create a called Shared_folder which can be accessed by ALL users (group name = users). Therefore, in order to map the drive in windows, the user is promoted to enter valid user credentials.

    Issue

    I have the following Shared_folder with the following permissions:

    drwxr-xr-x 2 nobody users 4096 Dec 27 00:24 Shared_folder 
    

    ..and the following Samba config:

    [Shared_folder]
        printable = no
        writeable = yes
        path = /home/Shared_folder
        force group = users
        comment = Common Documenets accessible by all users
        valid users = @users
        create mode = 757
        public = no
        directory mode = 777
    

    But it when I try to map the drive in windows im unable to pass the user validation part as it keeps failing.

    Could someone please shed some light as to how to get this working. Any help would be greatly appreciated.

    Thanks in advance.

    • Admin
      Admin over 11 years
      i hope you have restarted samba server after modifying smb config
    • Admin
      Admin over 11 years
      which OS you are installing samba server
    • Admin
      Admin over 11 years
      Using Turnkey Linux File Server (turnkeylinux.org/fileserver) which is running on Debian 6.0.5 (Squeeze). Also I have reestarted the samba server a every time i have made a change
    • Admin
      Admin over 11 years
      can u attache samba log (/var/log/samba/log.smbd)
  • AJsStack
    AJsStack over 11 years
    I added the logs above as requested. If there are still no obvious reasons why this should occur, could you please provide steps to create a Shared_folder which can be accessed by ALL users (group name = users).
  • AJsStack
    AJsStack over 11 years
    Im getting the following: chcon: can't apply partial context to unlabeled file '/home/Shared_folder' Also what does this do? and what is samba_share_t?
  • ren.rocks
    ren.rocks almost 5 years
    this did it for me. thanks. using stat [dir path], you should be able to see the current context and compare it with a working directory