AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1369771
Accepted
nobody
nobody
Asked: 2021-10-18 03:01:48 +0800 CST2021-10-18 03:01:48 +0800 CST 2021-10-18 03:01:48 +0800 CST

无法使用 loginctl 终止用户会话

  • 772

我正在使用 sddm 作为显示管理器运行 lubuntu 20.04。

每当我通过 gui 注销并以其他用户身份登录时,用户会话都不会被杀死(不知道它是否是设计使然)。所以 loginctl 为我的用户显示了双重会话。

我杀死的 2. 用户的所有会话

killall -u second_user_name

对于我的主要用户 3 个会话仍然存在。

我可以删除的具有最低会话 ID 的会话

sudo loginctl kill-session 3

剩饭剩菜

loginctl list-sessions 
SESSION  UID USER SEAT  TTY
     11 1000 alex seat0    
     21 1000 alex seat0    

下次试试

alex@Guilmon:~$ sudo loginctl kill-session 11
[sudo] Passwort für alex: 
alex@Guilmon:~$ loginctl list-sessions 
SESSION  UID USER SEAT  TTY
     11 1000 alex seat0    
     21 1000 alex seat0    

2 sessions listed.
alex@Guilmon:~$ 


How can I get rid of it? Or avoid this situation (more than one session per user)
lubuntu
  • 1 1 个回答
  • 663 Views

1 个回答

  • Voted
  1. Best Answer
    nobody
    2021-10-19T04:27:23+08:002021-10-19T04:27:23+08:00

    我想我发现要避免这种情况。在

    /etc/systemd/logind.conf
    
    KillUserProcesses=yes
    

    从手册页

    KillUserProcesses=
               Takes a boolean argument. Configures whether the processes of a user should be killed when the user logs out. If true, the scope unit
               corresponding to the session and all processes inside that scope will be terminated. If false, the scope is "abandoned", see
               systemd.scope(5), and processes are not killed. Defaults to "no", but see the options KillOnlyUsers= and KillExcludeUsers= below.
    
               In addition to session processes, user process may run under the user manager unit [email protected]. Depending on the linger settings, this may
               allow users to run processes independent of their login sessions. See the description of enable-linger in loginctl(1).
    
               Note that setting KillUserProcesses=yes will break tools like screen(1) and tmux(1), unless they are moved out of the session scope. See
               example in systemd-run(1).
    
    I restart 
    
        sudo systemctl restart systemd-logind.service 
    

    注销后 1. 用户并登录 2. 用户并返回

    alex@Guilmon:~$ loginctl 
    SESSION  UID USER SEAT  TTY
         15 1000 alex seat0    
    
    1 sessions listed.
    alex@Guilmon:~$ 
    

    不再等待在关闭或重新启动期间从废弃的用户会话中停止某些东西。

    • 1

相关问题

  • 我无法在 Hotot 中打开 URL

  • 如何使用 .html 文件作为桌面背景/壁纸?

  • 有没有办法强制 Ubuntu 对我的适配器使用 WPA?

  • 安装在 Live USB 驱动器上的顶级软件,用于 Windows 恢复

  • 替换 /home 后丢失 LXDE 菜单

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve