Have you ever wanted to check who’s online right now, if there’s any suspicious movement happening on your cloud?
Similar to unix who, follow live who is logged in with
→ nc-who ←
I have completely reworked this script, which was originally created here
It has a completely revised output. Since it updates at an adjustable refresh rate with watch, the formatted output from mysql was no longer usable. The solution was to output as html and back with html2text and sed in a usable, nice and neat format.
This tool is primarily intended for administrators of Nextcloud instances with many users. Of course, this is not intended for small servers used in familiary circles. But they can also want to take a look and then the tool is not far:
Restriction: only for MySQL/MariaDB Supported databases: MySQL/MariaDB, PostgreSQL
Auto-update with auto-backup: The script can now safely update itself. Backups are created that can be restored.
2023.07.02 01:15
PostgreSQL output is now same as MySQL/MariaDB output.
Improvements and bug fixes.
2023.08.11 16:00
Added realtime login status (online, offline or away) of user in monitor view
Added function ‘last_login’:
List users sorted by their last login time. This is equivalent to the output of
‘occ user:lastseen --all’
Note: ‘--all’ is actually not available for ‘occ user:lastseen’
2023.08.12 23:25
Improved ‘last_login’ to also include users that never loged in.
I’ve increased the functionality of nc-who a bit again. Specialy the last_login function could be interesting for some admins but the realtime login status in monitor view as well.
Here the new help screen:
Help:
nc-who - Version 2023.08.12 23:25 (latest version)
This utility is similar to the Unix `who` command, allowing you to monitor
live user logins and activities on your nextcloud server-instance.
Usage:
nc-who -h|--help
nc-who monitor
nc-who last_login
nc-who verify_my_integrity
Options:
-h|--help Display this help message.
monitor Monitor live user logins, ordered by last activity.
Updates occur at an adjustable refresh rate.
* Login status is only available for cookie-based sessions
on a web frontend.
* Last activity is shown for all clients.
last_login List users sorted by their last login time. This is equiva-
lent to the output of `occ user:lastseen --all`
* `--all` is actually not available for that occ command.
verify_my_integrity
verify the integrity of this script with signature
Those of you who already have it installed (version 2023.06.29 or newer) only need to call the script and the update will be offered automatically.