• Sharing files and folders with Samba-Definitive Guide - ERRATA-CORRIGE


    Sorry, but I had the wrong sequence of certain commands. following the proper guidance:

    ============================================
       FILE SHARING - WORKAROUND FOR ANTERGOS
    ============================================
    
             by Flavio Antonini - 2016
    

    install samba
    sudo pacman -S samba

    install nautilus sharing
    sudo pacman -S nautilus-share

    install “gnome-user-share”, by “pamac-manager” or following command:
    sudo pacman -S gnome-user-share

    stop the following service…
    sudo systemctl stop samba
    sudo systemctl stop smbd

    verify if “smb.conf” file exist…
    ls -l /etc/samba

    if not then copy the file “smb.conf.default” to “smb.conf”
    (this fix also sharing printer troubleshooting)…
    cd /etc/samba
    sudo cp smb.conf.default smb.conf

    select to “OFF” “Sharing Personal Files” on “Sharing” under “System Settings”…
    System Settings --> Sharing --> Sharing Personal Files --> “OFF”

    create a group “sambashare”…
    sudo groupadd -r sambashare

    create “usershare” folder…
    sudo mkdir -p /var/lib/samba/usershare

    change group of “usershare” folder…
    sudo chown root:sambashare /var/lib/samba/usershare

    change mode w/sticky bit on “usershare” folder…
    sudo chmod 1770 /var/lib/samba/usershare

    verify if your user is in samba DB…
    sudo pdbedit -L -v

    if not then add your user to samba
    (then create new sharing password)…
    sudo smbpasswd -a

    if previous command failed the try the following:
    gpasswd sambashare -a

    edit “smb.conf”…
    sudo gedit /etc/samba/smb.conf

    uncomment following line in “etc/samba/smb.conf” file
    under [global] settings section…
    include = /etc/samba/smb.conf.%m

    add following lines at the end of [global] section of
    “smb.conf” file then save file and exit gedit…
    usershare path = /var/lib/samba/usershare
    usershare max shares = 100
    usershare allow guests = yes
    usershare owner only = yes

    verifying if the following services is setting to “enable”…
    systemctl is-enables samba
    systemctl is-enables smbd

    if not then settings it to “enabled”…
    sudo systemctl enable samba
    sudo systemctl enable smbd

    now reboot linux…

    then, when system is ready, try to open nautilus (“File”)
    choose a folder to share, right click on it, then
    choose “Properties --> Sharing” and check “Sharing this folder”

    now view network resource in “Nautilus”, click on icon with your
    PC name, click on it, then click on shared folder
    and enter the sharing password previously set

    …and joy…

      NOTE: 
      1) Sometimes sharing is not immediately, and take some time to work
         after boot.
      2) If you uncheck "Sharing this folder", then you must click on unmount
         symbol on Nautilus tree to uncouple sharing.
  • @flanto
    Thanks for the great guide in setting up samba. I did have a couple of issues though. I’m able to share a directory as root but not as my user which I’m assuming is some sort of permissions thing I must have missed. But I’m also seeing this when using systemctl status samba or systemctl status smbd :

    samba.service - Samba AD Daemon
       Loaded: loaded (/usr/lib/systemd/system/samba.service; enabled; vendor preset: disabled)
       Active: failed (Result: exit-code) since Fri 2016-02-05 08:52:52 PST; 10min ago
     Main PID: 357 (code=exited, status=1/FAILURE)
    
    Feb 05 08:52:52 myuser systemd[1]: Starting Samba AD Daemon...
    Feb 05 08:52:52 myuser systemd[1]: samba.service: PID file /var/run/samba.pid not readable (yet?) after start: No such file or directory
    Feb 05 08:52:52 myuser systemd[1]: Started Samba AD Daemon.
    Feb 05 08:52:52 myuser systemd[1]: samba.service: Main process exited, code=exited, status=1/FAILURE
    Feb 05 08:52:52 myuser systemd[1]: samba.service: Unit entered failed state.
    
    smbd.service - Samba SMB/CIFS server
       Loaded: loaded (/usr/lib/systemd/system/smbd.service; enabled; vendor preset: disabled)
       Active: active (running) since Fri 2016-02-05 08:52:52 PST; 11min ago
     Main PID: 358 (smbd)
        Tasks: 3 (limit: 512)
       CGroup: /system.slice/smbd.service
               ├─358 /usr/bin/smbd -D
               ├─359 /usr/bin/smbd -D
               └─362 /usr/bin/smbd -D
    
    Feb 05 08:52:52 myuser systemd[1]: Starting Samba SMB/CIFS server...
    Feb 05 08:52:52 myuser systemd[1]: smbd.service: PID file /var/run/smbd.pid not readable (yet?) after start: No such file or directory
    Feb 05 08:52:52 myuser systemd[1]: Started Samba SMB/CIFS server.
    Feb 05 08:52:52 myuser smbd[358]: [2016/02/05 08:52:52.880154,  0] ../lib/util/become_daemon.c:124(daemon_ready)
    Feb 05 08:52:52 myuser smbd[358]:   STATUS=daemon 'smbd' finished starting up and ready to serve connections
    Feb 05 08:52:52 myuser smbd[362]: [2016/02/05 08:52:52.891319,  0] ../source3/printing/print_standard.c:69(std_pcap_cache_reload)
    Feb 05 08:52:52 myuser smbd[362]:   Unable to open printcap file /etc/printcap for read!
    

    Think I’ve found a way to hopefully get rid of the print cap errors but am not sure why samba.service is failing. Any thoughts or suggestions would be greatly appreciated. Thanks again for putting together this guide.

  • Truly, if the samba.service service fails to start with it is not decisive. What needs work is the smbd.service service, and how you write it seems to work. The problems with sharing of the printer and / or printcap could be due to a misconfiguration of /etc/samba/smbd.conf file and/or their permissions. Or it could be caused by a wrong printer driver. Try:

    [[email protected] ~]$ ls -l /etc/samba/smb.conf
    -rw-r–r-- 1 root root 10719 14 gen 20.59 /etc/samba/smb.conf

    and check permission, owner and group (both “root”). Then check if your account has included “sambashare” group:

    [[email protected] ~]$ id
    uid=1000(flavio) gid=100(users) gruppi=100(users),7(lp),10(wheel),90(network),91(video),92(audio),95(storage),618(sambashare)

    or via “groups” command:

    [[email protected] ~]$ groups
    lp wheel network video audio storage users sambashare

    if no, verify that exist sambashare group:

    [[email protected] ~]$ getent group sambashare
    sambashare:\x:618:flavio

    if one or more of the above steps does not provide the correct results, then review the main instructions. Also check that you have correctly inserted the provisions within the file “/etc/samba/smb.conf”. As a last resort, you can try:

    • sudo systemctl stop samba
    • sudo systemctl stop smbd
    • sudo mv /etc/samba/smbd.conf /etc/samba/smbd.conf.bak
    • sudo pacman -R samba # complete the uninstallation of samba
    • sudo pacman -Sy samba # re-install samba

    then repeat step by step all my main instructions from start to finish.

  • Thank you @flanto! I’ll try this over the weekend.

  • @flanto Thanks for taking the time to post this information. I’m sure it will be helpful to many users. However, the forum is actually not the proper place for such information. Information like this should be added to our Wiki. You can log into the wiki site using the same credentials as the forum. Adding a new article is pretty simple. If you (or anyone else) has a few minutes to spare, it would be awesome if you could add this to the Wiki so we can remove it from the forum. (There should only be one place users must search for info like this).

    Cheers!

  • @flanto
    Success! Took a few attempts to get things sorted out. Seems like even though smbpasswd -a seemed to worked I also had to use gpasswd sambashare-a. Thanks again!

share8 nmbd2 smbd4 samba20 folder8 Posts 6Views 1631
Log in to reply