Lista conectada via usuários SSH [duplicado]

1

Eu verifiquei esta resposta e esta opção - é bom, mas requer sudo direitos. Preciso que esse comando seja executado por qualquer usuário, por isso estou usando o próximo comando

ps -ef | grep sshd: | grep -v grep

e obtendo o seguinte resultado:

[owner@localhost ~]$ ps -ef | grep sshd: | grep -v grep
root      3175  2217  0 15:09 ?        00:00:00 sshd: [accepted] //Here just oppened putyy from windows pc
sshd      3177  3175  0 15:09 ?        00:00:00 sshd: [net]      //same as above
root      8062  2217  0 12:34 ?        00:00:00 sshd: root@pts/8 
root     24241  2217  0 13:37 ?        00:00:00 sshd: root@pts/10
root     31515  2217  0 14:38 ?        00:00:00 sshd: owner [priv] //non-root user connected
503      31567 31515  0 14:38 ?        00:00:00 sshd: owner@pts/12 //the same as above line

Como filtrar apenas conexões reais? Qual é o significado das palavras-chave " priv ", " accepted ", " net "?

P.S. Eu preciso fazer isso sem sudo direitos.

    
por ALZ 03.12.2014 / 16:13

1 resposta

2

Verifique o comando w :

w displays information about the users currently on the machine, and their processes. The header shows, in this order, the current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes.

The following entries are displayed for each user: login name, the tty name, the remote host, login time, idle time, JCPU, PCPU, and the command line of their current process.

The JCPU time is the time used by all processes attached to the tty. It does not include past background jobs, but does include currently running background jobs.

The PCPU time is the time used by the current process, named in the "what" field.

    
por 03.12.2014 / 16:27

Tags