Permission on a symlinked directory in a Samba share

5,541

Samba doesn't like symlinks for security reasons, and won't follow them unless you force it. Try adding

wide links = yes
unix extensions = no
follow symlinks = yes

to your smb.conf [GLOBAL] section and restart Samba. follow symlinks should already default to yes, but it won't hurt to set it again.

Share:
5,541

Related videos on Youtube

Charles Roper
Author by

Charles Roper

Digital Services Manager at Field Studies Council.

Updated on September 18, 2022

Comments

  • Charles Roper
    Charles Roper over 1 year

    I have a Samba share of my home directory set up as described here. On my Windows box I can access the share, open files and write to them. The server I am connecting to is an Ubuntu 12.04 VM running on Virtualbox.

    In my home directory I have symlinked /var/www to ~/www:

    charlesr@hicks:~$ ls -lad www
    lrwxrwxrwx 1 charlesr charlesr 8 Jul 16 18:45 www -> /var/www
    

    Even though the symlink is owned by me (charlesr), I cannot access it via Windows:

    Windows network error

    I've checked permissions on /var/www and that directory is part of the www-data group, which I am a part of:

    charlesr@hicks:~$ ls -lad /var/www
    drwxrwsr-x 3 root www-data 4096 Jul 16 18:13 /var/www
    
    charlesr@hicks:~$ grep www-data /etc/group
    www-data:x:33:charlesr
    

    So what am I missing here? Why can't I access this symlinked directory that my user has permission to read and write to? I'm new to Samba so I'm hoping it's something obvious.

  • Charles Roper
    Charles Roper almost 12 years
    Thank you, that was it. I wanted to understand what these settings meant so a bit of searching yielded this helpful page from the manual: samba.org/samba/docs/using_samba/ch08.html
  • Billy Moon
    Billy Moon about 11 years
    I am having the same issue, and on ubuntu server 10.10 this solves it for me, but on 12.04 the issue is persisting. My symlinks appear as unnavigable items like before I added the wide links = yes setting (to both the [global] section and [homes] section just to be sure). Any further ideas or places I can look to solve this?
  • charlesbridge
    charlesbridge about 11 years
    Did you sudo service smbd restart after the changes? I just tried it on Ubuntu 12.04.1 LTS and it still works for me.
  • Jake Wilson
    Jake Wilson over 10 years
    One note about this, it appears that unix extensions = yes HAS to be set in [GLOBAL]. It cannot be set only for an individual share. wide links and follow symlinks can be set only for individual shares just fine however.