DuckDuckGo and Google search Linux execute command on SSH connection.
A crontab would be a pretty bad solution.
Maybe can leverage authentication logs.
DuckDuckGo and Google search *Linux execute command on SSH connection*.
A crontab would be a pretty bad solution.
Maybe can leverage authentication logs.
Fri Nov 8 06:38:07 PM CET 2024
2024-11-08T18:38:04.547790+01:00 vps713872 systemd-logind[456]: Removed session 105.
2024-11-08T18:38:07.268411+01:00 vps713872 sshd[2816]: Accepted publickey for root from XXX.XXX.XXX.XXX port XXXXX ssh2: ED25519 SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
2024-11-08T18:38:07.269217+01:00 vps713872 sshd[2816]: pam_unix(sshd:session): session opened for user root(uid=0) by (uid=0)
2024-11-08T18:38:07.280685+01:00 vps713872 systemd-logind[456]: New session 107 of user root.
2024-11-08T18:38:07.289088+01:00 vps713872 sshd[2816]: pam_env(sshd:session): deprecated reading of user environment enabled
```bash
ssh root@lemnoslife.com 'date && tail -n 5 /var/log/auth.log'
```
<details>
<summary>Output:</summary>
```
Fri Nov 8 06:38:07 PM CET 2024
2024-11-08T18:38:04.547790+01:00 vps713872 systemd-logind[456]: Removed session 105.
2024-11-08T18:38:07.268411+01:00 vps713872 sshd[2816]: Accepted publickey for root from XXX.XXX.XXX.XXX port XXXXX ssh2: ED25519 SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
2024-11-08T18:38:07.269217+01:00 vps713872 sshd[2816]: pam_unix(sshd:session): session opened for user root(uid=0) by (uid=0)
2024-11-08T18:38:07.280685+01:00 vps713872 systemd-logind[456]: New session 107 of user root.
2024-11-08T18:38:07.289088+01:00 vps713872 sshd[2816]: pam_env(sshd:session): deprecated reading of user environment enabled
```
</details>
Could in theory modify .bashrc but I suspect that the user can avoid running this file, for instance by using SCP. Furthermore, the aim is to not trust the user to not remove this statement from .bashrc, as letting him the ability to modify this file.
Could in theory modify `.bashrc` but I suspect that the user can avoid running this file, for instance by using SCP. Furthermore, the aim is to not trust the user to not remove this statement from `.bashrc`, as letting him the ability to modify this file.
SSH open_session on LemnosLife VPS from benjamin!
SSH close_session on LemnosLife VPS from benjamin!
Being notified when the user logs out would also be interesting but in a second time. Maybe `${PAM_TYPE} = "open_session"` of https://www.it-connect.fr/linux-recevoir-un-e-mail-lors-dune-connexion-ssh/ would help.
```
SSH open_session on LemnosLife VPS from benjamin!
SSH close_session on LemnosLife VPS from benjamin!
```
vps713872
real 0m0.645s
user 0m0.116s
sys 0m0.011s
Without `&`:
```bash
time ssh benjamin@lemnoslife.com hostname
```
<details>
<summary>Output:</summary>
```
vps713872
real 0m6.683s
user 0m0.109s
sys 0m0.011s
```
</details>
Due to [Benjamin-Loison/matrix-commander/issues/16](https://github.com/Benjamin-Loison/matrix-commander/issues/16).
With `&`:
```bash
time ssh benjamin@lemnoslife.com hostname
```
<details>
<summary>Output:</summary>
```
vps713872
real 0m0.645s
user 0m0.116s
sys 0m0.011s
```
</details>
Would be nice to exclude multiple users without using `and`.
[The Stack Overflow answer 13408590](https://stackoverflow.com/a/13408590) helped to correct the *and* usage.
[The Stack Overflow question 11396740](https://stackoverflow.com/q/11396740) may help.
```
SSH open_session on LemnosLife VPS from anonymous!
SSH close_session on LemnosLife VPS from anonymous!
```
```bash
ssh anonymous@lemnoslife.com
```
<details>
<summary>Output:</summary>
```
This account can only be used for AUD
Connection to lemnoslife.com closed.
```
</details>
[Among-us-decentralized/blob/9d6b8c94c273b528c55ff12f56398d7f80116b5c/sources/main.cpp#L113](https://github.com/Benjamin-Loison/Among-us-decentralized/blob/9d6b8c94c273b528c55ff12f56398d7f80116b5c/sources/main.cpp#L113)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
DuckDuckGo and Google search Linux execute command on SSH connection.
A crontab would be a pretty bad solution.
Maybe can leverage authentication logs.
Output:
Could in theory modify
.bashrcbut I suspect that the user can avoid running this file, for instance by using SCP. Furthermore, the aim is to not trust the user to not remove this statement from.bashrc, as letting him the ability to modify this file.DuckDuckGo search Linux be notified of SSH connection.
Being notified when the user logs out would also be interesting but in a second time. Maybe
${PAM_TYPE} = "open_session"of https://www.it-connect.fr/linux-recevoir-un-e-mail-lors-dune-connexion-ssh/ would help.The purpose is to use
matrix-commander./etc/pam.scripts/ssh_alert.sh:Unsure if necessary:
/etc/pam.d/sshd:Without
&:Output:
Due to Benjamin-Loison/matrix-commander/issues/16.
With
&:Output:
Would be nice to exclude multiple users without using
and.The Stack Overflow answer 13408590 helped to correct the and usage.
The Stack Overflow question 11396740 may help.
Output:
Among-us-decentralized/blob/9d6b8c94c273b528c55ff12f56398d7f80116b5c/sources/main.cpp#L113
does not return anything.
to verify no connection during this algorithm establishment.