(OnTap 7.0.5)
From time to time our admin procedures mean that we have to move someone's home directory from one qtree to another. (I'd rather this didn't happen, but it's one of those things we have to live with for the time being...)
Inevitably, on some occasions a CIFS session for such a user is active at the time of the move. So if, the morning after the move, they simply pick up from where they left off the previous evening, their new data is still going into their old area. (This probably happens one every week or two on average.)
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.
(Such killing of potentially active (usually dormant) sessions is (while not ideal) nevertheless usually far preferable to picking up the pieces of two diverging home directories in the following days.)
But there doesn't seem to be any such "cifs terminate username". There is a "cifs sessions username", whose output is intended for humans, not machines, so is not easily amenable to reliable machine-parsing. So it is not really suitable for then reliably deriving workstation names for OnTap's existing "cifs terminate workstation" command.
Any thoughts on how to achieve "cifs terminate username" functionality?
By the way, the environment for driving this is a set of UNIX scripts which can do operations of the form: rsh filer cifs ...
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.
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.
Steve Losen scl@virginia.edu phone: 434-924-0640
University of Virginia ITC Unix Support
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?).
On 6/5/07, David Lee t.d.lee@durham.ac.uk wrote:
Any thoughts on how to achieve "cifs terminate username" functionality?
By the way, the environment for driving this is a set of UNIX scripts which can do operations of the form: rsh filer cifs ...
Hi,
Two things spring to mind: - You can close individual sessions from a Windows machine with the computer management MMC snap-in on it: connect to the filer, browse down to the open files & sessions (System Tools -> Shared Folders -> either "Sessions" or "Open Files") and disconnect users from there. - Since you are looking at scripting this from a Unix host, perhaps the easiest way to solve your problem is to dig into the "net" command from the Samba suite, eg.
http://us4.samba.org/samba/docs/man/manpages-3/net.8.html
See "net rap file" and "net rap session" should be able to do what you want to achieve.
Regards, Filip