[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [suse-security] Close all ssh sessions



Another method is to insert the commands into the user profile (as you
may require specific environment variables unless you code these into
your script) using the exec command followed by an exit command.


-----Original Message-----
From: Polarizer [mailto:Polarizer@xxxxxxxxxx] 
Sent: 24 November 2005 16:13
To: suse-security@xxxxxxxx
Subject: Re: [suse-security] Close all ssh sessions

Miguel ALBUQUERQUE schrieb:
> Hi,
> 
> How can one force closing an open ssh session ? I want to disconnect a

> user right after executing a script no waiting for a timeout. Is that 
> possible ?

I've 3 ideas

1st)

What about to replace the login shell in /etc/passwd with the script
the user can invoke. If script is done user gets logged out :O)_

youruser:x:1000:1000::/var/tmp/:/bin/yourscript

2nd)

One can invoke a script via

ssh a.ip.addr.ess "command"

so if you can disable interactive sessions in sshd it will fulfill your
requirements (Dunno how to accomplish that ad hoc)


3rd)

man bash

PPID   The process ID of the shell's parent.  This variable is readonly.

If one invokes a script this variable should contain the PID of the 
underlying bash. Just kill -9 $PPID in the of the script.

Hope that helps

the polarizer
http://www.codixx.de/polarizer.html

-- 
Check the headers for your unsubscription address
For additional commands, e-mail: suse-security-help@xxxxxxxx
Security-related bug reports go to security@xxxxxxx, not here


-- 
Check the headers for your unsubscription address
For additional commands, e-mail: suse-security-help@xxxxxxxx
Security-related bug reports go to security@xxxxxxx, not here