0

I read that I can add a line like this to /etc/ssh/sshd_config: ForceCommand /etc/ssh/loginscript.sh

The "loginscript.sh" is executable and only does screen -ls until now. I suppose the problem is, that it is executed in another shell instance, right? I didn't get any output on login yet.

EDIT: OK, I solved the initial problem: Normal users had no permissions to execute the script in /etc. I moved it to /, now it works and echos to the login shell.

Next problem: The SSH connection closes directly after the script is executed. Any suggestions?

1 Answer 1

1

Unless you want to severely restrict what your users can do, ForceCommand is not the way to go about doing this. Instead, add screen -ls to the bottom of the system-wide .bashrc (or equivalent, depending on what shell you're using).

For the bash shell on debian-based systems, you can find this at /etc/bash.bashrc.

1
  • Now I stumbled across the Problem, that the script is also being executed when I start screen. Do you have any other idea on how to display running screen sessions on SSH login? Maybe have a script running repeatedly, that puts the info in the /etc/motd ?
    – adrifromhh
    Commented Oct 27, 2015 at 11:16

You must log in to answer this question.

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