How can I autologin to desktop with systemd?
来源:互联网 发布:centos git ssh配置 编辑:程序博客网 时间:2024/06/07 13:24
This is described in the Arch Wiki:
Create a new service file similar to
getty@.service
by copying it to/etc/systemd/system/
cp /usr/lib/systemd/system/getty@.service /etc/systemd/system/autologin@.service
This basically copies the already existing getty@.service
to a new file autologin@.service
which can be freely modifed. It is copied to /etc/systemd/system
because that's where site-specific unit files are stored. /usr/lib/systemd/system
contains unit files provided by packages so you shouldn't change anything in there.
You will then have to symlink that autologin@.service
to the getty service for the tty on which you want to autologin, for examply for tty1:
ln -s /etc/systemd/system/autologin@.service /etc/systemd/system/getty.target.wants/getty@tty1.service`
Up to now, this is still the same as the usual getty@.service
file, but the most important part is to modify the autologin@.service
to actually log you in automatically. To do that, you only need to change the ExecStart
line to read
ExecStart=-/sbin/agetty -a USERNAME %I 38400
The difference between the ExecStart
line in getty@.service
and autologin@.service
is only the -a USERNAME
which tells agetty to log the user with the username USERNAME in automatically.
Now you only have to tell systemd to reload its daemon files and start the service:
systemctl daemon-reloadsystemctl start getty@tty1.service
(I'm not sure if the service will start properly if you're already logged in on tty1, the safest way is propably to just reboot instead of starting the service).
If you then want to automatically start X, insert the following snippet into your ~/.bash_profile
(taken from the wiki again):
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then exec startxfi
You will have to modify your ~/.xinitrc
to start your desktop environment, how to do that depends on the DE and is probably described in the Arch wiki as well.
- How can I autologin to desktop with systemd?
- RHEL7: How to get started with Systemd.
- How can I connect to Android with ADB over TCP?
- Why and How to Enable rc.local Support with Systemd
- How can I use Microsoft Visual C++ 2010 to create MEX files with MATLAB 7.10 (R2010a)?
- How can I use Microsoft Visual C++ 2010 to create MEX files with MATLAB 7.10 (R2010a)?
- How To Default To Search Companion With Windows Desktop Search
- wiki: How to grab the desktop (screen) with FFmpeg
- How to work with my desktop and laptop
- How can I change a file's encoding with vim?
- How can I get file extensions with JavaScript?
- How can I capture the audio output with GStreamer?
- How can I convert String to Int in C#?
- How can I add properties to an object at runtime?
- How can I convert NSDictionary to NSData and vice versa?
- How can I convert NSDictionary to NSData and vice versa?
- How can I convert printStackTrace message to a string?
- linux autologin with root
- MySql错误:[Err] 1292
- POJ 1258 Agri-Net(最小生成树-Prim)
- 15入门阶段综合练习
- 【HDU】6048
- 让你用一次就会爱上的 5 个 web 工具类产品
- How can I autologin to desktop with systemd?
- QT-输入框右键菜单翻译文件安装
- POJ 1915:Knight Moves(BFS)
- 跨过程序设计门槛之厘清计算机系统
- bugku 变量1
- 201403-1 相反数
- git bash 命令行有中文乱码的解决
- 简单加密与验签
- Java线程池(ExecutorService)使用