• linux强制踢出已登录的用户及本地用户


    方法一:

    pkill -kill -t pts/0

    方法二:

    fuser -k /dev/pts/0

    你也可以给他发送关闭信息然后关闭

    echo "你被管理员踢出了" > /dev/pts/1 && fuser -k /dev/pts/1

    事情是这样的,一台云主机ubuntu的默认是没有开启的root的,我用新建的用户tx登录后调整可以root登录,然后使用root登录删除tx用户

    root@idctxcom:~# userdel tx
    userdel: user tx is currently used by process 1941    ##报错显示用人在用tx使用进程。
    root@idctxcom:~# who   ###查看是谁在登录
    tx       tty1         2019-05-17 03:38    ###这个是本地登录的
    tx       pts/0    183.14.133.4     03:40    2:25   0.03s  0.03s -bash ###这个是同事在登录
    root pts/1 2019-05-17 03:43 (183.14.133.4) ###这个是我自己
    root@idctxcom:~# pkill -kill -t pts/0 ###踢掉同事登录
    root@idctxcom:~# pkill -kill -t tty1 ###踢掉本地登录的用户
    root@idctxcom:~# who
    root     pts/1        2019-05-17 03:43 (183.14.133.4)
    root@idctxcom:~# userdel tx ##删除成功
    root@idctxcom:~#
  • 相关阅读:
    cmd命令操作Mysql数据库
    可编程作息时间控制器设计
    博客第一天
    PRML 1: Gaussian Distribution
    KMP String Matching Algorithm
    Reinstall Ubuntu 14.04
    Computability 4: Decidability and R.E. Sets (I)
    Consumer-Producer Problem
    Compile the Linux Kernel
    Introduction to Linux Kernel
  • 原文地址:https://www.cnblogs.com/Crazy-Liu/p/10880623.html
Copyright © 2020-2023  润新知