Jump to content

Automatic Login


syrial

Recommended Posts

Just made my first GPIO script in python for the Orange Pi One but now am looking for some assistance in getting Armbian to login automatically on boot and run the script as sudo. Any help would be greatly appreciated.

Link to comment
Share on other sites

The most simple solution would be to start your script from the file /etc/rc.local.

Just add a line starting your script before the "exit 0" line last in the /etc/rc.local file.

 

In this way there is no need to login. The file /etc/rc.local is run automatically by the system at boot.

Link to comment
Share on other sites

Just add a line starting your script before the "exit 0" line last in the /etc/rc.local file.

 

Three remarks:

  • Leaving 'exit 0' as last line is somehow critical since /etc/rc.local exiting with an exit code not being 0 might prevent the OS from further booting
  • It's always a good idea to send execution to the background (add ' &') to the end of the line
  • In certain situations the environment might be different when script are started from a GUI context or from /etc/rc.local. In such cases it helps comparing the output of env and export (in a script called from rc.local simply redirect output to a file eg. 'env >/tmp/env.txt' and check contents after a reboot)

BTW: All the time consuming performance and consumption tests I currently do are run from /etc/rc.local since it's the only way to ensure a sane environment that can be checked afterwards if something strange occurs :)

Link to comment
Share on other sites

Just thought i'd share.

SystemD service to automatically logon main screen (tty1) as user root, during boot:

 

 

mkdir -p /etc/systemd/system/getty@tty1.service.d
cat << _EOF_ > /etc/systemd/system/getty@tty1.service.d/autologin.conf
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin root %I
_EOF_
systemctl daemon-reload

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines