J0RDIE97
Posts: 3
Joined: Sat May 21, 2016 5:37 am

Auto Login Raspbian Jessie

Sat May 21, 2016 6:26 am

Hi, I'm trying to make a project for uni that requires the pi to reboot a couple times. Only issue is that the pi needs authentication to login everytime the pi is rebooted. Is there anyway of overcoming this, or changing the startup process such that it does not need to login. This is for the ssh btw.

Is there anyone that can help?

epoch1970
Posts: 5132
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Auto Login Raspbian Jessie

Sat May 21, 2016 9:49 am

Can't you use raspi-config and set console or graphical environment auto-login?
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Auto Login Raspbian Jessie

Sat May 21, 2016 9:54 am

epoch1970 wrote:Can't you use raspi-config and set console or graphical environment auto-login?
The OP asked:
This is for the ssh btw.

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Auto Login Raspbian Jessie

Sat May 21, 2016 9:57 am

J0RDIE97 wrote:Hi, I'm trying to make a project for uni that requires the pi to reboot a couple times. Only issue is that the pi needs authentication to login everytime the pi is rebooted. Is there anyway of overcoming this, or changing the startup process such that it does not need to login. This is for the ssh btw.

Is there anyone that can help?
Investigate the use of public/private key pairs for ssh authentication. By using an agent on the 'remote' [non-RPi] device to provide the private part of the key-pair, login can be made to look 'automatic', while still being secure.

broe23
Posts: 903
Joined: Thu Jan 28, 2016 9:35 pm
Location: Central IL
Contact: Website

Re: Auto Login Raspbian Jessie

Sun May 22, 2016 4:42 am

You can set up Rasbian to automatically log in without user interaction. The reason why Linux is not allowed to log itself in at boot, is for security reasons. Also you really do not need to in order to run a Cron job to do the timed reboot.
Ren: Now listen, Cadet. I've got a job for you. See this button? Ren: Don't touch it! It's the History Eraser button, you fool! Stimpy: So what'll happen? Ren: That's just it. We don't know. Maybe something bad, maybe something good.

J0RDIE97
Posts: 3
Joined: Sat May 21, 2016 5:37 am

Re: Auto Login Raspbian Jessie

Sun May 22, 2016 1:06 pm

B.Goode wrote:
J0RDIE97 wrote:Hi, I'm trying to make a project for uni that requires the pi to reboot a couple times. Only issue is that the pi needs authentication to login everytime the pi is rebooted. Is there anyway of overcoming this, or changing the startup process such that it does not need to login. This is for the ssh btw.

Is there anyone that can help?
Investigate the use of public/private key pairs for ssh authentication. By using an agent on the 'remote' [non-RPi] device to provide the private part of the key-pair, login can be made to look 'automatic', while still being secure.
Do you know of a good tutorial to go through this process? Much appreciated!

broe23
Posts: 903
Joined: Thu Jan 28, 2016 9:35 pm
Location: Central IL
Contact: Website

Re: Auto Login Raspbian Jessie

Sun May 22, 2016 4:37 pm

Redhat has plenty of them. Since you are doing a timed job, it is only going to need to be ran as a Cron Job as I mentioned before.

If you let it be logged in. Anyone can access it. Make sure you disable Wifi and Bluetooth if a Pi 3. Also disable SSH and FTP ports.
Ren: Now listen, Cadet. I've got a job for you. See this button? Ren: Don't touch it! It's the History Eraser button, you fool! Stimpy: So what'll happen? Ren: That's just it. We don't know. Maybe something bad, maybe something good.

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: Auto Login Raspbian Jessie

Sun May 22, 2016 4:55 pm

J0RDIE97 wrote:Investigate the use of public/private key pairs for ssh authentication. By using an agent on the 'remote' [non-RPi] device to provide the private part of the key-pair, login can be made to look 'automatic', while still being secure.
Do you know of a good tutorial to go through this process? Much appreciated!
If you've created a key with the ssh-keygen command, you can just copy that key to the machine you want to be able to access without a password using the ssh-copy-id command, e.g.:

ssh-copy-id wally@jimmy

Your ssh configuration information for each account is normally stored in ~/.ssh which won't exist until you've run the ssh-keygen command. Investigate the file ~/.ssh/config which can be used to store details for the account's ssh use including for each command. For example:

Host bobby.ssh
HostName wally
user jimmy

Then you can run your script with

ssh bobby.ssh

and it will automatically log in. The advantage of this over just typing ssh jimmy@wally is that you can have a lot more configuration details than I had above including sharing ssh connections so you can go in and out of programs that connect ssh without the overhead of authenticating each time.
Last edited by stderr on Sun May 22, 2016 11:36 pm, edited 1 time in total.

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Auto Login Raspbian Jessie

Sun May 22, 2016 5:04 pm

broe23 wrote: Also disable SSH and FTP ports.
Are we answering the same question?

Because I am answering the one where @J0RDIE97 says: "this is for ssh"

broe23
Posts: 903
Joined: Thu Jan 28, 2016 9:35 pm
Location: Central IL
Contact: Website

Re: Auto Login Raspbian Jessie

Sun May 22, 2016 8:48 pm

If the OP is doing a unit like they want. SSH, FTP & SFTP need to be locked down. Along with if it is a Pi3, Bluetooth and Wifi not enabled.

They really just need a Pi and a small non-touch LCD screen to show the output.
Ren: Now listen, Cadet. I've got a job for you. See this button? Ren: Don't touch it! It's the History Eraser button, you fool! Stimpy: So what'll happen? Ren: That's just it. We don't know. Maybe something bad, maybe something good.

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: Auto Login Raspbian Jessie

Sun May 22, 2016 11:40 pm

broe23 wrote:If the OP is doing a unit like they want. SSH, FTP & SFTP need to be locked down.
So if the original poster wants to automatically log in with ssh, they need to disable ssh? What he seems to be building involves, it appears, only logging in via ssh.

J0RDIE97
Posts: 3
Joined: Sat May 21, 2016 5:37 am

Re: Auto Login Raspbian Jessie

Mon May 23, 2016 12:54 pm

stderr wrote:
broe23 wrote:If the OP is doing a unit like they want. SSH, FTP & SFTP need to be locked down.
So if the original poster wants to automatically log in with ssh, they need to disable ssh? What he seems to be building involves, it appears, only logging in via ssh.
yes, just the ssh

Return to “Beginners”