User avatar
red_mamba
Posts: 37
Joined: Wed Feb 22, 2012 8:49 am

enable SSH access in raspbian-lite.img

Sat Mar 25, 2017 12:58 pm

Any one knows how to enable SSH access in raspbian image?

I want SSH to be up and running when I burn the image and power up the device.
Making my custom raspbian img for a project.

DirkS
Posts: 9839
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: enable SSH access in raspbian-lite.img

Sat Mar 25, 2017 1:04 pm

After writing the image you just create a file named 'ssh' or 'ssh.txt' on the first partition
(that's the only partition visible from Windows)

Electron752
Posts: 142
Joined: Mon Mar 02, 2015 7:09 pm

Re: enable SSH access in raspbian-lite.img

Sat Mar 25, 2017 10:48 pm

I just normally do "apt-get openssh-server". I known Raspbian has a custom control to enable it, but I'm not sure how it works at the moment and I don't have Raspbian available.

Just creating a file named that is really bad news.

Electron752
Posts: 142
Joined: Mon Mar 02, 2015 7:09 pm

Re: enable SSH access in raspbian-lite.img

Sat Mar 25, 2017 10:50 pm

Oh, I understand what your saying more. I think you need to wait until the RPI boots before you can enable that.

Electron752
Posts: 142
Joined: Mon Mar 02, 2015 7:09 pm

Re: enable SSH access in raspbian-lite.img

Sat Mar 25, 2017 10:51 pm

And if you really want to make an image, you can configure the RPI, power it down, then image the SD card after your are finished.

mfa298
Posts: 1387
Joined: Tue Apr 22, 2014 11:18 am

Re: enable SSH access in raspbian-lite.img

Sun Mar 26, 2017 12:27 am

Electron752 wrote:I just normally do "apt-get openssh-server". I known Raspbian has a custom control to enable it, but I'm not sure how it works at the moment and I don't have Raspbian available.

Just creating a file named that is really bad news.
Raspbian has openssh-server installed but disabled by default. Putting the ssh file in the boot (FAT) partition is a way to signal to a startup script to enable ssh (it's a method that can be setup from any OS for a headless pi), you could also use systemctl enable to enable it from within raspbian, but that requires a keyboard and screen

User avatar
red_mamba
Posts: 37
Joined: Wed Feb 22, 2012 8:49 am

Re: enable SSH access in raspbian-lite.img

Sun Mar 26, 2017 11:38 am

Thanks guys.

I guess I could just mount first partition and add ssh.txt file there.
But I will try systemctl enable first. because I'm already poking on the second partition.

I have this image build in the cloud on my Jenkins build machine running ubuntu, so some suggestions just won't work for me.
Sorry, didn't mention this before.

Return to “General discussion”