我想将Raspberry Pi设置为在特定用户中自动登录。 我搜索了这个,我发现的解决方案是关于编辑/ etc / inittab文件。我的问题是现在我没有那个文件,它似乎在我的Raspbian版本中丢失了。 还有另一种方法吗?
答案 0 :(得分:6)
我的autologin.conf文件如下所示。请注意%I
,否则我的pi会挂起:
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin pi --noclear %I 38400 linux
答案 1 :(得分:4)
我假设您正在使用最新的Raspian-Image(jessie)。这个基于Debian 8(jessie),其中init-system从sysvinit更改为systemd。我认为这可能与你的问题有关。如果你谷歌:raspbian jessie auto login
,你应该找到解决问题的方法。
体育专业。 this link提供了一种可能的解决方案:
$ 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
末尾添加以下行[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx
答案 2 :(得分:1)
我找到了这个,这是唯一对我有用的东西。
打开终端,首先备份我们要编辑的文件:
su -
gedit /etc/lightdm/lightdm.gedit /etc/lightdm/lightdm.conf.back
立即编辑此文件:
gedit /etc/lightdm/lightdm.conf
或
nano /etc/lightdm/lightdm.conf
取消注释这两行:
autologin-user=USERNAME
autologin-user-timeout=0
将USERNAME替换为您自己的用户名。保存文件并退出。立即运行此命令,以使更改生效:
dpkg-reconfigure lightdm
答案 3 :(得分:1)
我使用raspi-config
:
pi@raspberrypi:~ $ sudo raspi-config
Created symlink /etc/systemd/system/default.target → /lib/systemd/system/graphical.target.
出现菜单,其中您选择 Boot Options
,然后选择B1 Boot Desktop Options
行,最后您可以选择多个自动登录选项。
请参阅:https://raspberrypi.stackexchange.com/questions/48241/auto-login-in-jessie-how