Looking for a simple way to do this from the command line.
List samba shares and the users who can access each of them.
List samba shares and the users currently connected to them.
List samba shares and every connection (log, including user) that has been established to each of them.
Any ideas? Anything you use that's currently available that will give me the bits I need to put this together?
Cheers!
Try
smbclient -L ip_of_net_interface -U your_user_name
. This option allows you to look at what services are available on a server. You use it assmbclient -L host
and a list should appear.Try to use
smbstatus
, it seems to be what you need.Will retrieve what's being shared and which machine (if any) is connected to what.
Also, on most systems, typing
testparm
will give you info about the samba shares of the machine you're currently using. After you press enter at the prompt it'll also show you every uncommented line of smb.conf which can be useful.Try
net usershare info --long
.Getting the users
Getting the shares per user
Less verbose than
smbclient -L
isnet rpc share list -U $USERNAME
You'll need both because the list of visible shares differs per user.
Use the command
pdbedit
.Where
-L
is to list users &-v
is to be verbose.While
smbstatus --shares
list active connections in your computer, you may want to know which folders are selected as samba shared, even when no current connection is active.Go into this directory and you will get the name of such folders: