On Tue, 5 Jun 2007, Stephen C. Losen wrote:
What we're looking for is something like: cifs terminate username
that we could employ to kill off the CIFS session(s) for a given username.
cifs terminate takes an optional "workstation" parameter. You can use "cifs sessions username" to get the workstation name and then plug it into "cifs terminate". I suppose a user could have sessions going on multiple workstations.
Indeed they could have a set of sessions. Which complicates the parsing even further.
It looks like it is possible for multiple users to have CIFS sessions active on the same workstation, which would happen if a person logs in to CIFS using multiple accounts. But it also appears that you can only terminate all CIFS sessions for a workstation. So you still don't get exactly what you want, but it's close.
A point to note. Thanks.
The key, fundamental point here is making this scriptable. The output of "cifs sessions username" is for humans. Parsing that, in a reliable, predictable fashion is not easy. Further, it could well break at subsequent releases of OnTap if those releases present the human-oriented output in a different pretty-printed way.
An option to "cifs sessions username" that said "present the output in a machine-friendly, easily-parseable, and release-sustainable manner" would be a way forward. But such an option doesn't exist (does it?).