无需 etc/inittab 的树莓派自动登录 [英] Raspberry Pi auto login without etc/inittab
问题描述
我想将我的 Raspberry Pi 设置为以特定用户自动登录.我用谷歌搜索了这个,我发现的解决方案是关于编辑/etc/inittab 文件的.我的问题是现在我没有那个文件,它似乎在我的 Raspbian 版本中丢失了.还有其他方法可以做到这一点吗?
I would like to settup my Raspberry Pi to auto login in a specific user. I googled this and the solutions that i found were about editing the /etc/inittab file. My problem is now i dont have that file, it appears to be missing in my version of Raspbian. Is there another way to do this?
推荐答案
我假设您使用的是最新的 Raspian-Image (jessie).这个基于 Debian 8 (jessie),其中 init-system 从 sysvinit 更改为 systemd.我认为这可能与您的问题有关.如果您使用谷歌搜索:raspbian jessie auto login
,您应该会找到解决问题的方法.
I assume you're using the latest Raspian-Image (jessie). This one is based on Debian 8 (jessie) where the init-system changed from sysvinit to systemd. I think that it could have something to do with your problem. If you google: raspbian jessie auto login
you should find a solution for your problem.
p.e.此链接 提供了一个可能的解决方案:
p.e. this link provides a possible solution:
$ sudo -i
# mkdir -pv /etc/systemd/system/getty@tty1.service.d
# nano /etc/systemd/system/getty@tty1.service.d/autologin.conf
插入以下文本:
[Service]
ExecStart=-/sbin/agetty --autologin $username --noclear I 38400 linux
确保 $username
是您的用户名
然后重启.
可选:
如果你想自动启动 X-Server,只需在你的 ~/.profile 末尾添加以下行
If you want to start the X-Server automatically, just add the following line at the end of your ~/.profile
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx
这篇关于无需 etc/inittab 的树莓派自动登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!