• 欢迎访问金笔头博客,这是一个菜鸟(伪)程序员的自留地,欢迎访问我的github:点击进入

VPN(PPTP)查看当前在线用户

Linux eason 2620次浏览 2个评论 扫描二维码

这两天开了不少VPN账户,有时候想看看各个账户的活跃度,pptpd没有查看到相关命令。上网查了下说last里面会记录用户登录信息。从last命令中检索稍微麻烦点,可以将命令写入bashrc或者profile中。

1.last查看全部用户登录信息

root@wys:~# last
root     pts/0        101.85.206.144   Sat Nov 21 02:39   still logged in   
chengao  ppp0         10.204.48.119     Fri Nov 20 13:34 - 13:34  (00:00)    
chengao  ppp0         10.204.48.119     Fri Nov 20 12:58 - 13:31  (00:33)    
chengao  ppp0         10.204.48.119     Fri Nov 20 11:24 - 11:51  (00:27)    
chengao  ppp0         10.204.48.119     Fri Nov 20 11:17 - 11:22  (00:04)    
chengao  ppp0         10.204.48.119     Fri Nov 20 11:15 - 11:16  (00:00)    
chengao  ppp0         10.204.48.119     Fri Nov 20 11:15 - 11:15  (00:00)    
chengao  ppp1         10.204.48.119     Fri Nov 20 11:14 - 11:14  (00:00)    
chengao  ppp0         10.204.48.119     Fri Nov 20 10:54 - 11:14  (00:19)    
chengao  ppp1         10.204.48.119     Fri Nov 20 10:50 - 10:50  (00:00)    
chengao  ppp1         10.204.48.119     Fri Nov 20 10:49 - 10:49  (00:00)    
chengao  ppp1         10.204.48.119     Fri Nov 20 10:48 - 10:48  (00:00)    
chengao  ppp1         10.204.48.119     Fri Nov 20 10:45 - 10:47  (00:02)    
root     pts/1        101.85.206.144   Fri Nov 20 10:34 - 13:38  (03:04)    
jinbitou ppp0         101.85.206.144   Fri Nov 20 10:28 - 10:54  (00:25)    
liuhong  ppp0         58.246.9.158     Fri Nov 20 04:13 - 04:30  (00:16)    
jinbitou ppp1         58.246.9.158     Fri Nov 20 01:19 - 01:22  (00:03)    
liuhong  ppp0         58.246.9.158     Fri Nov 20 00:03 - 04:12  (04:09)    
liuhong  ppp0         116.238.167.194  Wed Nov 18 09:04 - 09:09  (00:05)    
liuhong  ppp0         116.238.167.194  Wed Nov 18 08:51 - 08:52  (00:01)    
jinbitou ppp0         58.246.9.158     Tue Nov 17 23:38 - 23:44  (00:06)    
jinbitou ppp0         101.85.206.144   Tue Nov 17 10:51 - 11:00  (00:09)    
jinbitou ppp0         101.85.206.144   Tue Nov 17 07:36 - 09:00  (01:23)    
root     pts/1        58.246.9.158     Tue Nov 17 04:03 - 05:39  (01:35)    
liuhong  ppp0         58.246.9.158     Tue Nov 17 03:29 - 05:33  (02:04)    
jinbitou ppp0         101.85.206.144   Mon Nov 16 18:41 - 18:48  (00:07)    
maser    ppp0         116.216.30.5     Mon Nov 16 18:13 - 18:17  (00:03)    
jinbitou ppp0         101.85.206.144   Mon Nov 16 08:25 - 08:34  (00:08)    
liuhong  ppp0         140.207.23.232   Mon Nov 16 05:29 - 05:31  (00:02)    
jinbitou ppp0         140.207.23.232   Mon Nov 16 05:27 - 05:28  (00:00)    
jinbitou ppp1         58.246.9.158     Mon Nov 16 03:21 - 03:36  (00:14)    
jinbitou ppp1         58.246.9.158     Sun Nov 15 23:12 - 23:18  (00:06)    
liuhong  ppp0         58.246.9.158     Sun Nov 15 21:23 - 05:12  (07:49)    
liuhong  ppp0         58.246.9.158     Sun Nov 15 21:19 - 21:19  (00:00)    
root     pts/0        112.97.61.8      Sun Nov 15 18:48 - 18:50  (00:02)    
root     pts/0        112.97.61.8      Sun Nov 15 18:44 - 18:46  (00:02)    
jinbitou ppp1         101.85.206.144   Sun Nov 15 09:02 - 09:03  (00:01)    
jinbitou ppp1         96.44.165.110    Sun Nov 15 09:01 - 09:01  (00:00)    
jinbitou ppp0         101.85.206.144   Sat Nov 14 10:56 - 11:10 (1+00:14)   
root     pts/1        101.85.206.144   Sat Nov 14 10:25 - 10:32  (00:07)    
jinbitou ppp0         101.85.206.144   Sat Nov 14 10:09 - 10:35  (00:26)    
jinbitou ppp0         101.85.206.144   Sat Nov 14 09:32 - 10:06  (00:33)    
liuhong  ppp0         101.85.206.144   Sat Nov 14 08:26 - 08:30  (00:04)    
liuhong  ppp0         101.85.206.144   Fri Nov 13 11:45 - 11:45  (00:00)    
root     pts/0        101.85.206.144   Fri Nov 13 09:10 - 09:54  (00:44)    
liuhong  ppp0         58.246.9.158     Thu Nov 12 20:54 - 20:55  (00:00)    
root     pts/0        58.246.9.158     Thu Nov 12 20:53 - 20:54  (00:01)    
jinbitou ppp0         58.246.9.158     Thu Nov 12 20:51 - 20:51  (00:00)    
jinbitou ppp0         58.246.9.158     Thu Nov 12 20:47 - 20:48  (00:00)    
jinbitou ppp0         58.246.9.158     Thu Nov 12 20:39 - 20:42  (00:02)    
jinbitou ppp0         58.246.9.158     Thu Nov 12 20:31 - 20:32  (00:00)    
jinbitou ppp0         58.246.9.158     Thu Nov 12 20:23 - 20:24  (00:01)    
jinbitou ppp0         58.246.9.158     Thu Nov 12 20:15 - 20:16  (00:00)    
jinbitou ppp0         112.97.51.173    Wed Nov 11 19:12 - 19:32  (00:19)    
jinbitou ppp0         112.97.61.114    Wed Nov 11 06:08 - 06:18  (00:10)    
maser    ppp0         58.246.9.158     Wed Nov 11 01:02 - 01:11  (00:09)    
maser    ppp0         58.246.9.158     Wed Nov 11 00:53 - 01:02  (00:08)    
jinbitou ppp1         58.246.9.158     Wed Nov 11 00:45 - 00:48  (00:02)    
jinbitou ppp1         58.246.9.158     Wed Nov 11 00:43 - 00:44  (00:00)    
maser    ppp0         58.246.9.158     Wed Nov 11 00:38 - 00:53  (00:14)    
maser    ppp0         58.246.9.158     Wed Nov 11 00:37 - 00:38  (00:00)    
maser    ppp0         117.131.3.90     Wed Nov 11 00:22 - 00:27  (00:04)    
maser    ppp0         58.246.9.158     Wed Nov 11 00:17 - 00:19  (00:02)    
maser    ppp0         58.246.9.158     Wed Nov 11 00:12 - 00:13  (00:01)    
root     pts/0        58.246.9.158     Wed Nov 11 00:09 - 05:49  (05:40)    
jinbitou ppp0         58.246.9.158     Wed Nov 11 00:02 - 00:03  (00:00)    
jinbitou ppp1         101.85.206.144   Tue Nov 10 07:42 - 08:15  (00:32)    
jinbitou ppp1         101.85.206.144   Tue Nov 10 07:41 - 07:42  (00:00)    
jinbitou ppp0         112.97.55.161    Tue Nov 10 06:47 - 07:42  (00:54)    
jinbitou ppp0         112.97.55.161    Tue Nov 10 05:38 - 05:46  (00:07)    
jinbitou ppp0         58.246.9.158     Mon Nov  9 19:33 - 19:34  (00:00)    
jinbitou ppp1         58.246.9.158     Mon Nov  9 19:32 - 19:33  (00:00)    
jinbitou ppp1         58.246.9.158     Mon Nov  9 19:32 - 19:32  (00:00)    
jinbitou ppp0         112.97.59.44     Mon Nov  9 19:12 - 19:33  (00:20)    
jinbitou ppp1         112.97.59.44     Mon Nov  9 18:58 - 19:07  (00:08)    
jinbitou ppp0         112.97.59.44     Mon Nov  9 18:28 - 18:58  (00:29)    
jinbitou ppp1         101.85.206.144   Mon Nov  9 10:39 - 10:50  (00:10)    
jinbitou ppp1         101.85.206.144   Mon Nov  9 10:39 - 10:39  (00:00)    
jinbitou ppp1         101.85.206.144   Mon Nov  9 10:23 - 10:36  (00:12)    
root     pts/2        101.85.206.144   Mon Nov  9 09:53 - 18:06  (08:13)    
jinbitou ppp0         101.85.206.144   Mon Nov  9 09:22 - 17:40  (08:17)    
jinbitou ppp1         101.85.206.144   Mon Nov  9 09:13 - 09:19  (00:05)    
jinbitou ppp0         101.85.206.144   Mon Nov  9 09:12 - 09:20  (00:07)    
jinbitou ppp1         101.85.206.144   Mon Nov  9 08:48 - 08:53  (00:05)    
jinbitou ppp0         101.85.206.144   Mon Nov  9 08:47 - 08:54  (00:06)    
jinbitou ppp1         101.85.206.144   Mon Nov  9 08:37 - 08:40  (00:02)    
jinbitou ppp0         101.85.206.144   Mon Nov  9 08:34 - 08:47  (00:12)    
jinbitou ppp0         101.85.206.144   Mon Nov  9 08:34 - 08:34  (00:00)    
root     pts/0        101.85.206.144   Mon Nov  9 08:13 - 18:06  (09:53)    
reboot   system boot  2.6.32-042stab11 Mon Nov  9 08:13 - 02:52 (11+18:39)  

wtmp begins Mon Nov  9 08:13:05 2015

2.查看在线用户只要在last命令后加上管道符号|和grep命令即可

root@wys:~# last | grep still
jinbitou ppp0         101.85.206.144   Sat Nov 21 03:08   still logged in   
root     pts/0        101.85.206.144   Sat Nov 21 02:39   still logged in

3.查看当前VPN在线用户

root@wys:~# last | grep ppp | grep still
jinbitou ppp0         101.85.206.144   Sat Nov 21 03:08   still logged in   

4.如果觉得每次都要打这么长命令很繁琐,可以使用别名并将其写入环境变量即可

VPN(PPTP)查看当前在线用户

5.使用source命令使修改过的环境变量立即生效,下次再查看在线的VPN用户时直接敲别名就可以

root@wys:~# source /etc/profile
root@wys:~# vpnlive
jinbitou ppp0         101.85.206.144   Sat Nov 21 03:08   still logged in   
root@wys:~# 

金笔头博客, 版权所有丨如未注明 , 均为原创, 转载请注明VPN(PPTP)查看当前在线用户
喜欢 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(2)个小伙伴在吐槽
  1. Very informative post.Really thank you! Really Great.
    hot lesbian porn2016-02-03 09:10 Reply Windows XP | Opera 9.64
  2. A round of applause for your article.Thanks Again. Awesome.
    porno streaming2016-01-02 17:03 Reply Windows XP | Firefox 3.0.14