How to record shell commands of all ssh sessions of all users accessing the same router/server to a log file in linux?

fox18

without using any built-in commands like history because if history is cleared all commands will be gone,but in my log file it must be present every time. As per my understanding, 1.A daemon should start running in background when user login through ssh, it redirects all commands to a log file. 2.Log file should have max of 500 commands(done through logrotate.conf)

Whether I have to to code change in sshd daemon? or how to do this?

xenoid

Define "user command". There are lines of input, but you can't tell if they are commands (read by the top-level shell) or inputs to applications, and this latter case would include commands in a second-level shell. Then you don't know what happens in screen-based editors (nano, vi) and you don't know what scripts do.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to install a module for all users with pip on linux?

How to list all users in a Linux group?

How can run JavaScript code for all users at the same time and display the same generated numbers for all users

How to get all sessions in Vaadin

How can I invalidate all of a single users sessions?

How to list all users in the mongo shell?

Laravel: Logout/clear all sessions for all users from app

How do we install rustc, cargo for all the users in the same linux machine?

How to list all users in the Cassandra shell?

How do I log all UNIX shell commands submitted by all users?

How to check umask for all users under Linux?

How to log all Bash commands by all users on a server?

Prefix all commands in shell

How to automatically record all your terminal sessions with script utility

Place all sed commands into one shell script file

How to track all ip sessions on a linux machine

How to set default DISPLAY for all SSH sessions?

Make commands available across all PuTTY sessions?

How to interactively run all commands in a file

How to interactively run all commands in a file in zsh?

Login log for all users

How to log off all user from ssh client in ssh server?

How to display all commands of the bash shell in a file? Linux

How to have same state for all users?

Docker build - use the same shell for all RUN commands

How to automatically log all my `tmux` sessions to a file in directory, accordingly to my session name?

how to Create log file for all commands in one file using python

How to determine "number of concurrent sessions" for all users on a server

How to set a password for all users (Bash Linux)