Is it possible to see commands that user have run over ssh?

0

I am running a ssh-service on my computer and clients connect to it from all over the network. Is it possible to see the commands that people have run on my computer?

for example a user connects to my computer and runs a few commands, I want to log and see all the commands that he and other users have used (their command history).

orezvani

Posted 2013-07-24T03:11:41.353

Reputation: 157

Answers

0

Depends on which distribution of Linux your using:

psacct for RHEL, CentOS and Fedora. acct for Ubuntu, Debian and Linux Mint.

Both provide a lot more than command history, they can summarize commands for example so you can see how often gcc or grep is run, how much CPU time they consumed, memory consumed etc.

Short guide on Tecmint: How to Monitor User Activity with psacct or acct Tools

Brian

Posted 2013-07-24T03:11:41.353

Reputation: 8 439

-1

su to the account and run the command history.

FACTORY909

Posted 2013-07-24T03:11:41.353

Reputation: 1

so it can't save a log file for each individual connection? or for each individual user? – orezvani – 2013-07-24T03:26:00.937

@emab I don't think it's trivial to monitor ssh-input because it is designed with user privacy in mind. I think it would be far less cumbersome to hack bash (and the other shells) on your system and monitor input that way. The history files are writable by the users, so anyone can flush their history and delete the files before logging out. Alternatively, one could monitor the terminal-stdout files in /dev/pts. That would be far less work to set up. What do you wand to accomplish with this anyway? – Ярослав Рахматуллин – 2013-07-24T04:29:29.067