Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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!

share|improve this question
    
We can list shares from command line using smbtree. We can parse: /etc/samba/smb.conf /var/lib/samba/usershares/*.conf –  komputes Feb 14 '12 at 18:45

5 Answers 5

Try to use smbstatus, it seems to be what you need.

share|improve this answer

Try net usershare info --long.

/usr/bin/net -> /etc/alternatives/net
/etc/alternatives/net -> /usr/bin/net.samba3

man net

net - Tool for administration of Samba and remote CIFS servers.

share|improve this answer

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.

share|improve this answer

A slight improvement to what mentioned in other replies:

smbstatus --shares

Will retrieve what's being shared and which machine (if any) is connected to what.

share|improve this answer

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 as smbclient -L host and a list should appear.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.