I still cant access a share.

delphi package - easy access to security apis
Post Reply
Leonel
Posts: 1
Joined: Thu Jun 29, 2006 2:02 pm

I still cant access a share.

Post by Leonel »

I´m using this code:

Code: Select all

NewShare(DirPath, 'Share').Acl.SetFileAccess(Everyone,True);
I am seeing the share but I can't access in another computer. Say that I dont have a permission.
I sharing in WinXP and access in Win98 or 2003 Server.

I read the entire forum and I do not find anything that works for me.

I have to do a project in school and madsecurity will save my ass.

Tanks and sorry my english.

Leonel
madshi
Site Admin
Posts: 10527
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Network access works only if *both* the share security attributes and the NTFS directory security attributes allow access.
DiegoGarcia
Posts: 6
Joined: Wed Sep 20, 2006 4:29 pm

Post by DiegoGarcia »

So how should we do it ?
For me it doesnt work either :/

Can you give us a sample code ?

Thanks a lote,
Diego.
madshi
Site Admin
Posts: 10527
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

First of you all need to find out what's wrong with the share you created. You should do so by using the Windows shell. Once you know where the settings are not satisfying, let me know, then I can tell you what to do.
DiegoGarcia
Posts: 6
Joined: Wed Sep 20, 2006 4:29 pm

Post by DiegoGarcia »

Ok I will give you some steps to reproduce the problem.

First Create an folder at C:\ named Test.
Second open the program with a button nammed "share folder" with the follow code NewShare('C:\Test','testShare$').Acl.SetFileAccess(Everyone,True);

Now go to other computer and try to access the shared folder by typing "\\computerName\testShare$".
Windows will throw an exception "Access Denied **"

Now back to the computer that has the shared path, simple rigth click on the folder "C:\Test", select "Sharing and Security" then just uncheck the option "Share This folder" and check it again, then click on "apply" button.

Now try to access the folder from the other pc, it will works !

Any help ?

Thanks madshi ;)

Regards,
Diego.
madshi
Site Admin
Posts: 10527
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Can you please check what security settings madSecurity has filled into the share? Do you see any obvious error?

Can't test it myself right now, cause I've no network where I'm currently.
DiegoGarcia
Posts: 6
Joined: Wed Sep 20, 2006 4:29 pm

Post by DiegoGarcia »

how can I see the security setting on win xp ?

Thanks Madshi
madshi
Site Admin
Posts: 10527
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

On the property page where you can share the folder, there should be a button labeled "access rights" or something like that.

Wait, I think there are two sharing modes. Something like simple file sharing and normal/full file sharing. Maybe your PC is configured to use simple file sharing? madSecurity is meant to do full file sharing. I'm not sure how that behaves if your PC is configured to do simply file sharing... :?
DiegoGarcia
Posts: 6
Joined: Wed Sep 20, 2006 4:29 pm

Post by DiegoGarcia »

Ok I will have a look on how to setup it to show that option!

Thanks madshi, I will post the result here latter !

Regards,
Diego.
DiegoGarcia
Posts: 6
Joined: Wed Sep 20, 2006 4:29 pm

Post by DiegoGarcia »

Hi good news madshi,
to disable the simple file share mode you have to click on the Tools menu from Explorer and select folder options the uncheck the option simple file sharing mode.

Now it works fine the program, share and it works !

Now the question is, how can we disable this option using our delphi program ?

Regards,
Diego.
madshi
Site Admin
Posts: 10527
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Hmmmm, I don't know that myself, unfortunately. My PCs are all setup so that "simple" file sharing isn't used. Have you tried googling for a solution? Have no other idea, either...
Rockaholic
Posts: 1
Joined: Fri Dec 01, 2006 4:22 pm

Same issue, and possible solution.

Post by Rockaholic »

I had the same issue where i could create the share, and it would show up fine, but would get an access denied error when trying to access it.

Doing some testing i determined it had nothing to do with simple file shareing, same error regardless of which shareing mode.

The fix i came up with was this...

//Create Share
NewShare(GetRootPath(GetCurrentDir), ShareName).Acl.SetFileAccess(Everyone,True);
//File Leve Security
FileSecurity(GetRootPath(GetCurrentDir)).DAcl.SetFileAccess(Account('Everyone'), true);

The problem being that the share was being created, and the share permissions set, but the file level permission wasnt set, so you still would get the access denied.
Post Reply