0

How do you automatically start a program when someone connects via ssh.

With ubuntu when someone connects with ssh it automatically shows if any updates are available. I would like an app to automatically run when a person logs in to show them some information.

I've searched on Google to try and find something like this but the only things I can find is how to make the ssh service to start automatically at boot up.

2
  • Is the user who logs in you or somebody else? Commented May 20, 2016 at 18:39
  • Voted for closure, not a programming question. Commented May 20, 2016 at 19:16

1 Answer 1

3

You can put a script in ~/.ssh/rc. From the sshdman page:

~/.ssh/rc

Contains initialization routines to be run before the user's home directory becomes accessible. This file should be writable only by the user, and need not be readable by anyone else.

You can alsoe use the /etc/ssh/sshrc file.

/etc/ssh/sshrc

Similar to ~/.ssh/rc, it can be used to specify machine-specific login-time initializations globally. This file should be writable only by root, and should be world-readable.

For more information, read the SSHRC section of the sshd man page.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.