hierynomus / smbj

Server Message Block (SMB2, SMB3) implementation in Java
Other
713 stars 180 forks source link

Get list of all shares in a machine #566

Closed kvk484 closed 4 years ago

kvk484 commented 4 years ago

Hi Do smbj latest versions support listing of all shares in a machine?

ecki commented 4 years ago

No, this is not a smb function. The smbj-Rpc project supports that, see #274

kvk484 commented 4 years ago

Thanks for the reply. Is smbj api backward compatible? Since smbj-rpc latest version using 0.8 version of smbj. But latest version of smbj is 0.10. In my env i want to use latest version of smbj for other use cases. So I want to understand if i can use smbj-rpc with 0.10 version of smbj

ecki commented 4 years ago

I guess you need to try it, maybe the smbj-rpc project would like to know the result as well.

kvk484 commented 4 years ago

thank you. Closing this issue.

kvk484 commented 4 years ago

Hi @ecki can you please tell the minimum user permissions required to list down all the shares ? I can get info level 0 , but not able to get info level 2. what permission do i require for listing down level 0 infos and what do i require for 2?

ecki commented 4 years ago

Sorry, no idea what level 0/2 is. And I don't know what the various server implementations have for permission requirements.

Just to be sure, shares are not hierarchical and shares/directories are differnt things.

pepijnve commented 4 years ago

@kvk484 this isn't really the appropriate forum for this type of question IMO. The smbj developers can help with issues in the library itself, but the basic workings of the SMB protocol and related RPC services is out of scope for a client library.

The documentation you're looking for is the MS-SRVS specification. In particular the NetrShareGetInfo RPC call. All the way at the bottom you'll find

The server SHOULD<60> enforce security measures to verify that the caller has the required permissions to execute this routine. If the caller does not have the required credentials, the server SHOULD<61> fail the call.

Footnote 60 in turn links to the 'Product behaviour' which describes what the Windows SMB server specifically does:

<60> Section 3.1.4.10: If the requested level is 2, 502, or 503, the Windows implementation checks to see whether the caller is in the Administrators, Server or Print Operators, or Power Users local group. No special group membership is required for other levels.
kvk484 commented 4 years ago

Hi team Thanks a lot for the info provided. That was quite helpful. Will make sure , I will ask only smbj relevant questios here.