You are not logged in.

#1 2010-10-23 04:06:02

Skeer
Member
Registered: 2009-09-17
Posts: 20

Running SSH command after auth

To save some time, I know about sshrc...

What I am trying to do is run a script (or file or whatever) after a user is authenticated... This is extremely simple with the use of sshrc, but my users are going to be connecting with the -N argument:
-N     Do not execute a remote command.  This is useful for just forwarding ports (protocol version 2 only).

When users are connecting with that, my script does not run...

Is there an alternate way to run a script?

By the way... The reason I'm doing this is because I am running a SOCKS server and the users are set to /bin/false.

Offline

#2 2010-10-23 08:51:51

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,847

Re: Running SSH command after auth

You could put it in their .profile, maybe?


"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

#3 2010-10-23 16:32:10

Skeer
Member
Registered: 2009-09-17
Posts: 20

Re: Running SSH command after auth

I do not believe profile would run if their shell is set to /bin/false...

And after testing it, it doesn't run, and it also doesn't run when you use -N...

Maybe I'm using the wrong profile...
I edited /etc/profile.

Offline

#4 2010-10-23 20:17:06

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,847

Re: Running SSH command after auth

Ah now, you're probably right there, sorry. Need to check whether anything does get called - profile.d?


"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

#5 2010-10-24 00:56:17

Skeer
Member
Registered: 2009-09-17
Posts: 20

Re: Running SSH command after auth

profile.d gets the same result...

I tried reading the sshd's source, but I can't seem to find where the -N flag takes effect...

Offline

#6 2010-10-24 17:40:59

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 2,001
Website

Re: Running SSH command after auth

what problem are you trying to solve?  maybe we can do this in another way.


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

#7 2010-10-25 01:30:38

Skeer
Member
Registered: 2009-09-17
Posts: 20

Re: Running SSH command after auth

Well I am trying to run a script after ssh authentication when the client is connecting with the -N flag....

I am hosting a socks proxy server, and I want to prevent simultaneous logins with the same user. The proxy users all have the shell set to /bin/false and their default group set to 'proxy '.
Basically, what I want to do is to disconnect both connections when I detect simultaneous logins...

Offline

Board footer

Powered by FluxBB