2

using smbstatus that reports on current connections. Is there a way to save, or have, the information reported from smbstatus for ALL samba connections that have happened over some period of time?

Specifically, the columns of UID, SharePath, Name, Time reported by smbstatus I would like to have every one of those at least.

And ideally, for each of those samba connections is there a way to know the hostname or ip address it came from?

update:

so I think all I need is in smb.conf under [global]

  • log level = 3 passdb:5 auth:5

I am then able to find relevant info in /var/log/samba/log.smbd such as

  • Got user=[my username]
  • workstation=[my computer name]
  • Allowed connection from ip address (ip address)

any help regarding passdb:# and auth:# would be much appreciated.

1 Answer 1

1

The commands configured in the preexec and postexec options of Samba are run when a connection to a share is made and disconnected. You could use that to create log entries of those events.

Such simple logging could be achieved by adding this to the global section of your smb.conf file:

preexec = /usr/bin/logger -t smbd 'connecting to %S on %L by %u at %m os %a using %R ip %I'
postexec = /usr/bin/logger -t smbd 'disconnect of %S on %L by %u at %m'

Example output:

Oct 31 13:14:55 dev smbd: connecting to stuff on dev by roel at 192.168.30.1 os Samba using SMB3_11 ip 192.168.30.1
Oct 31 13:15:03 dev smbd: disconnect of stuff on dev by roel at 192.168.30.1

Note that these logs will most likely wind up in syslog or messages, depending on how your system is configured.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .