0

Suppose I have two solaris servers, A and B, and I am connecting from one server to another using sftp.

Suppose B tries to connect to A using SFTP.

Then How to detect in A the sftp request sent by B ? Is there any way by which I can have a message displayed on the client console(like putty) through which I am logged in to A stating "B is trying to connect to you"?

I thought of running a particular script ,which searches for an sftp in the list of processes, continuously between small spans of time but I think that would not be accurate.

Now can I send a message back to B from A as soon as B succeeds in logging in that will be displayed in client screen through which I am logged in to B?

Can all these be accomplished by shell scripting? I generally get to use solaris, so is there a solaris specific answer?

1 Answer 1

0

You can use the command wall to send a message to all terminals:

SYNOPSIS
wall [-n] [-t timeout] [-g group] [message | file]

DESCRIPTION
wall displays a message, or the contents of a file, or otherwise its standard input, on the terminals of all currently logged in users.

You can configure sshd to use PAM (if that is available under Solaris) and use pam_exec (https://linux.die.net/man/8/pam_exec) to get notified every time an SSH login takes place. At that stage it is probably not determined yet, though, whether it is an SFTP session. You could start a script in the background which somehow checks for SFTP.

3
  • How to send back to the user who just logged in ? Apr 28, 2018 at 18:46
  • @AgniveshSingh I am not really familiar with PAM but this information must be passed somehow, probably as an environment variable or as an parameter to the binary to be called. Apr 28, 2018 at 18:59
  • Ok..I will try it once ..don't know if solaris has it or not Apr 29, 2018 at 10:53

You must log in to answer this question.

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