DOS and NT filesystems don't have symbolic links; Windows 95/98/NT systems approximate this with "shortcuts" instead. Therefore, when a client tries to open a symbolic link on a Samba server share, Samba attempts to follow the link to find the real file and let the client open it, as if he or she were on a Unix machine. If you don't want to allow this, set the
follow
symlinks
option:
[data]
path = /home/samba/data
browseable = yes
guest ok = yes
writeable = yes
case sensitive = no
follow symlinks = no
You can test this by creating a directory on the Unix server inside the share as the user that you are logging in with. Enter the following commands:
%
mkdir hello; cd hello
%
cat "This is a test" >hello.txt
%
ln -s hello.txt "Link to hello"
This results in the two files shown in the window in
Figure 5.5. Normally, if you click on either one, you will receive a file which has the text "This is a test" inside of it. However, with the
follow
symlinks
option set to
no
, you should receive an error similar to the dialog in
Figure 5.5 if you click on "Link to hello."
Finally, let's discuss the
wide
links
option. This option, if set to
yes
, allows the client user to follow symbolic links that point outside the shared directory tree, including files or directories at the other end of the link. For example, let's assume that we modified the
[data]
share as follows:
[data]
path = /home/samba/data
browseable = yes
guest ok = yes
writeable = yes
case sensitive = no
follow symlinks = yes
wide links = yes
As long as the
follow
symlinks
option is enabled, this will cause Samba to follow all symbolic links outside the current share tree. If we create a file outside the share (for example, in someone's home directory) and then create a link to it in the share as follows:
ln -s ~tom/datafile ./datafile
then you will be able to open the file in Tom's directory as per the target file's permissions.