How to follow symlinks on Samba shares?

Enterprise-class NAS, Intel Core 2 Duo, 4GB DDR2 SDRAM, VMware Ready, 10GbE Ready, 7- and 8-bay NAS, 32-bit OS

Moderator: John Tsai

How to follow symlinks on Samba shares?

Postby Darkguy » Wed Nov 30, 2011 8:59 pm

Hello,

We have a Thecus N7700 Pro running the latest 5.01.05 firmware.

Here's what I want to do, so maybe there is an easier solution to my problem than using symlinks on Samba:

Each of our users has his own folder (user1, user2, etc.) , that only he/she can access. There are also various group folders (workgroup1, departments2) that should be accessible by everybody in that group. As the Thecus doesn't allow applying different ACLs to subfolders (or does it?), I've created all the necessary user and group folders in the root via the web-interface. As Windows only can connect to one folder at a time (two if you use hostnames and IPs), my idea was to put symlinks to the group folders into the user folders and have every user connect to his user folder to access all his group folders too (I'd manually create only these group folders the user needs to see, there are only about 10 users, so I can do this manually).

I've installed META, SYSUSER and FaJoSSHD, logged in as sys via SSH and created the symlinks via ln -s in the various folders. I've then created a bash script that will add/edit "follow symlinks = yes" and "wide links = yes" into /raid0/sys/smb.conf at boot time (via META, and the the values are there at run-time, so that's not the problem).

Still, under Windows 7, I can see the various symlinked folders, but can not access them (it tells me I lack access). When mounting the share in Ubuntu, I don't even see the symlinks. I can access them just fine via SSH and FTP, so the problem has to be somewhere at the Samba end. I know there was a security issue with symlinks a while back, but I managed to enable this feature on my Ubuntu box, using the syntax from above (plus "unix extensions = no", which is already in the Thecus smb.conf).

So is there any way to do this or some other work-around to achieve what I'd like to accomplish?
Darkguy
 
Posts: 3
Joined: Wed Nov 30, 2011 8:40 pm

Re: How to follow symlinks on Samba shares?

Postby HanSooloo » Thu Dec 01, 2011 5:21 am

Happened to me a lot ... logging in via "sys" and doing some file operations ... results in the file being owned by root. Can you check if your symlinks have the same owner:group of your shared folders?
HanSooloo
 
Posts: 21
Joined: Fri Jul 16, 2010 9:25 pm

Re: How to follow symlinks on Samba shares?

Postby Darkguy » Thu Dec 01, 2011 7:06 pm

Actually that was something I noticed yesterday and forgot in my initial post: The symlinks are owned by root:root and chown <username> <symlink> doesn't change that. I suspected that was a problem. Any way to change that?
Darkguy
 
Posts: 3
Joined: Wed Nov 30, 2011 8:40 pm

Re: How to follow symlinks on Samba shares?

Postby fajo » Thu Dec 01, 2011 7:20 pm

Darkguy wrote:Actually that was something I noticed yesterday and forgot in my initial post: The symlinks are owned by root:root and chown <username> <symlink> doesn't change that. I suspected that was a problem. Any way to change that?


run
Code: Select all
chown -h <user>:<group> <symlink>


the argument "-h" disables dereferencing of symlinks. You will also have to check the path name the symlink points to - this one will now have root:root and may no longer be accessible by users ;o)

/Falk
For more information and to download my modules please visit me at www.fajo.de

    APCUPSD BaculaDIR BaculaDIRpg BaculaDIRmy BaculaSD BaculaFD DavMailGW FaJoClamAV FaJoCron FaJoDHCPServer FaJoDNSServer FaJoNetATalk FaJoNTPServer FaJoSSHD FaJoTorrent ModBase1 NETSNMPD OpenLDAP OracleJRE6 OracleJRE7 Perl514 PHP53 PHP54 PHPExtensions Python2 Python3 rSyslog SQUID3 TonidoServer X86Base ZoneMinder
fajo
Third-Party Developer
 
Posts: 1236
Joined: Wed Mar 31, 2010 3:22 pm
Location: Germany

Re: How to follow symlinks on Samba shares?

Postby Darkguy » Thu Dec 01, 2011 7:38 pm

ok, I managed to get the owner changed using chwon <username> -Rh <symlink>, but I still get the same behaviour
Darkguy
 
Posts: 3
Joined: Wed Nov 30, 2011 8:40 pm

Re: How to follow symlinks on Samba shares?

Postby fajo » Fri Dec 02, 2011 3:24 pm

Darkguy wrote:ok, I managed to get the owner changed using chwon <username> -Rh <symlink>, but I still get the same behaviour


"chown -Rh <username> <symlink>" will only change the ownership of the symlink (-R has no effect). Since you changed the targets ownership before, you will have to change this back to whatever it was by calling "chown <username> <symlink>". This will not touch the symlink but change the targets ownership. If you previously used "-R" without "-h" you will have to run "chown -R <username> <symlink>" to fix it instead.

This is just the way to fix the permissions. Permissions may or may not be the reason for your issue.

/Falk
For more information and to download my modules please visit me at www.fajo.de

    APCUPSD BaculaDIR BaculaDIRpg BaculaDIRmy BaculaSD BaculaFD DavMailGW FaJoClamAV FaJoCron FaJoDHCPServer FaJoDNSServer FaJoNetATalk FaJoNTPServer FaJoSSHD FaJoTorrent ModBase1 NETSNMPD OpenLDAP OracleJRE6 OracleJRE7 Perl514 PHP53 PHP54 PHPExtensions Python2 Python3 rSyslog SQUID3 TonidoServer X86Base ZoneMinder
fajo
Third-Party Developer
 
Posts: 1236
Joined: Wed Mar 31, 2010 3:22 pm
Location: Germany

Re: How to follow symlinks on Samba shares?

Postby victor-zorro » Tue Feb 14, 2012 11:04 pm

Hi,

I have the same problem.
Managed to create symlinks
and installed script that adjust smb.conf
worked for 2 years like a charm.
now updated to firmwar 5.x
and it does not work anymore.

if I manually adjust smb.conf and restart samba, it still does not work!

any help would be welcom!

thanx
victor-zorro
 
Posts: 1
Joined: Tue Feb 14, 2012 10:58 pm

Re: How to follow symlinks on Samba shares?

Postby custhe » Mon May 14, 2012 4:42 am

Hey guys,

Here is what I had to do on my N3200PRO, maybe this is a possible solution for you as well.

The /etc/samba/smb.conf file is recreated from the /raid/sys/smb.db (SQLite DB) on samba (re)start. So the simplest way to permanently get the "follow symlink" and "wide links" lines into the conf file is to edit this database.

In SSH put the following commands:

Code: Select all
sqlite /raid/sys/smb.db

insert into smb_share (k,v,m) values ('follow symlinks','yes','0');
insert into smb_share (k,v,m) values ('wide links','yes','0');
.exit


then restart your device.

You will see the two lines
follow symlinks = yes
wide links = yes

in every samba share of the /etc/samba/smb.conf.

You should now be able to follow symbolic links on samba.
custhe
 
Posts: 4
Joined: Tue May 10, 2011 4:12 am


Return to N7700PRO/N8800PRO

Who is online

Users browsing this forum: No registered users and 4 guests