linux系统(Ubuntu)之合上笔记本盖但不断网
配置场景:ubuntu电脑作为服务器,开机后把盖合上,省的屏幕亮。刚开始一盖上电脑盖电脑就断开网络,导致其他客户端电脑无法访问服务器。修改配置方法如下:编辑下列文件:/etc/systemd/logind.conf#HandlePowerKey按下电源键后的行为,默认power off#HandleSleepKey 按下挂起键后的行为,默认suspend#HandleHiberna...
配置场景:ubuntu电脑作为服务器,开机后把盖合上,省的屏幕亮。刚开始一盖上电脑盖电脑就断开网络,导致其他客户端电脑无法访问服务器。修改配置方法如下:
编辑下列文件:/etc/systemd/logind.conf
#HandlePowerKey按下电源键后的行为,默认power off
#HandleSleepKey 按下挂起键后的行为,默认suspend
#HandleHibernateKey按下休眠键后的行为,默认hibernate
#HandleLidSwitch合上笔记本盖后的行为,默认suspend(改为lock;即合盖不休眠)在原文件中,还要去掉前面的#
运行:systemctl restart systemd-logind 就会生效。
--------------------------------------------------------------------------------------------------
附上运行演示:
[root@liangxiaozhan]# vim /etc/systemd/logind.conf
# This file is part of systemd.
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
# See logind.conf(5) for details.
[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
HandleLidSwitch=ignore (在这里把#号去掉,然后把默认suspend改成ignore)
#HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=no
#UserTasksMax
[root@liangxiaozhan]# systemctl restart systemd-logind (运行重启生效或者重启电脑)
更多推荐
所有评论(0)