Jump to content

Recommended Posts

abarbarian
Posted

I have been trying to set up a Raspberry Pi project.

 

 octopus-agile-pi-prices

 

I think I have followed the guide given to setting up the Pi.

 

Quote
  • Download Respberry Pi Imager from the raspberry pi page https://www.raspberrypi.org/downloads/raspbian/
  • Press "Operating system" then select "Raspberry Pi OS (Other)" > "Raspberry Pi OS Lite (32 bit)"
  • Choose your storage
  • Click the advanced cog icon, then fill out the info to enable headless boot
    • You could enter "octoprice" as the hostname
    • Enable SSH, and enter your public key or a password
    • Set a username and password
    • Configure Wireless LAN
    • Set your locale
    • Save
  • Press write

 

The Pi seems to work as the green light flashes on start up.

 

Trouble is I can not access the Pi through shh. My main pc is connected to the router though a Ethernet cable and the Pi has a wireless dongle.

 

I have

 

sudo systemctl status sshd
● sshd.service - OpenSSH Daemon
     Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; preset: dis>
     Active: active (running) since Tue 2024-01-23 09:49:43 GMT; 7min ago
   Main PID: 2449 (sshd)
      Tasks: 1 (limit: 19107)
     Memory: 2.1M (peak: 2.1M)
        CPU: 5ms
     CGroup: /system.slice/sshd.service
             └─2449 "sshd: /usr/bin/sshd -D [listener] 0 of 10-100 startups"

Jan 23 09:49:43 longship systemd[1]: Started OpenSSH Daemon.
Jan 23 09:49:43 longship sshd[2449]: Server listening on 0.0.0.0 port 22.
Jan 23 09:49:43 longship sshd[2449]: Server listening on :: port 22.

 

When I try to connect to the Pi it fails

 

-->ssh PiUser@PiProject.local
ssh: Could not resolve hostname PiProject.local: Name or service not known

 

Can anyone give me some insight as to what is wrong or where to look. I have spent ages trawling the net and just keep on getting more and more confused. I think I have ssh set up right but there is something I am not spotting.🤔

securitybreach
Posted

Its listening on the wrong IP:

 

Server listening on 0.0.0.0 port 22

 

You should have that set as the IP of the machine the server is running on as shown below (my setup)

 

/etc/ssh/ssd_config:

 

Port 28935
AddressFamily any
ListenAddress 192.168.2.8

 

Then restart ssh

abarbarian
Posted

Ok Have done tons more reading and got no where yet again due to too much information or asking the wrong questions on Google.

 

1 hour ago, securitybreach said:

You should have that set as the IP of the machine the server is running on

 

I get that I can choose a random port and the AddressFamily.

 

How do I determine the listen address ???????????

 

If I do " ip addr " I get

 

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute 
       valid_lft forever preferred_lft forever
2: enp8s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 40:8d:5c:e0:e4:ac brd ff:ff:ff:ff:ff:ff
3: enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 40:8d:5c:e0:e4:aa brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.10/24 brd 192.168.1.255 scope global dynamic noprefixroute enp0s31f6
       valid_lft 78645sec preferred_lft 78645sec
    inet6 fe80::8c93:d558:9383:2974/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
4: surfshark_ipv6: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
    link/ether 7e:b3:dd:e6:c5:7c brd ff:ff:ff:ff:ff:ff
    inet6 fdbe:2bde:b490:9e47::/64 scope global noprefixroute 
       valid_lft forever preferred_lft forever
    inet6 fe80::b01b:96d0:b6e0:9a77/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

 

So do I use a address from this range " 192.168.1.10/24 " or from somewhere else ??

 

🤔

abarbarian
Posted

Well I made the changes to "/etc/ssh/sshd_config "

 

Port 28946
AddressFamily any
ListenAddress 192.168.2.8
#ListenAddress ::

 

did

 

sudo systemctl start sshd

 

tried

 

>ssh agileprice@octopuss.local
ssh: Could not resolve hostname octopuss.local: Name or service not known

 

tried

 

sudo systemctl start ssh
Failed to start ssh.service: Unit ssh.service not found.

 

then

 

>sudo systemctl status sshd
● sshd.service - OpenSSH Daemon
     Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; preset: dis>
     Active: active (running) since Tue 2024-01-23 09:49:43 GMT; 3h 30min ago
   Main PID: 2449 (sshd)
      Tasks: 1 (limit: 19107)
     Memory: 2.1M (peak: 2.1M)
        CPU: 5ms
     CGroup: /system.slice/sshd.service
             └─2449 "sshd: /usr/bin/sshd -D [listener] 0 of 10-100 startups"

Jan 23 09:49:43 longship systemd[1]: Started OpenSSH Daemon.
Jan 23 09:49:43 longship sshd[2449]: Server listening on 0.0.0.0 port 22.
Jan 23 09:49:43 longship sshd[2449]: Server listening on :: port 22.


So it looks like the changes I made did not stick and there is something else wrong  but I still have no idea what. ?????????? 🤔

abarbarian
Posted

I came across this post whilst getting completely confused which helped me to be even more confused.

 

In case you have edited your /etc/ssh/ssh{,d}_config

 

Quote

Have you added custom configuration to your /etc/ssh/sshd_config or /etc/ssh/ssh_config?

If you have, you don't have to maintain those modifications anymore every time the official package changes those files. About a week ago, the Arch package openssh migrated to the drop-in (.d) configuration files system. In other words, you can let the package maintainers take care of /etc/ssh/sshd_config and move all your own modifications under the /etc/ssh/sshd_config.d/ drop-in directory as separate files. In fact, even Arch moved its defaults to /etc/ssh/sshd_config.d/00-archlinux.conf and /etc/ssh/sshd_config is just following the upstream default config of OpenSSH.

 

😎

Posted (edited)

I've used dd from the cli more times than I've used Imager program to set up RPi.. just be careful with it.   I'm setting up headless most of the times too.  The link shows how to setup SSH and wpa-supplicant.  This is how I do it the majority of the times.  On my phone, I use Fing to see it it's connecting. 

Edited by wa4chq
Hedon James
Posted

I usually connect via ssh with the local IP address:

ssh jim@172.16.0.2

 

i used to login with machine names:

ssh jim@asus-SS

but something changed with samba, and now i can only log in via IP address.  this affected several of my bookmarks in my PCManFM file browser, and I had to edit them for the new protocols.  i wonder if you aren't experiencing a similar issue?

 

also, FWIWy, my addresses are dynamic and sometimes change on me. i used to look 'em up in smbtree, but that only showed machine names, not IP addresses.  Since i need the IP address for ssh, now I log into my router and check it out there.  One of these days, i'll learn to set static addresses, but i use ssh and sftp so infrequently that it hasn't been enough of an issue to make it a priority.  but if i was setting up a headless server and that was the only way to access it.....yeah, i'd set it up with a static address from the get-go.  But i'd use the local IP address rather than the server name.

  • +1 1
securitybreach
Posted
1 hour ago, abarbarian said:

I came across this post whilst getting completely confused which helped me to be even more confused.

 

In case you have edited your /etc/ssh/ssh{,d}_config

 

 

😎

 

That is something I have never seen or heard of. My /etc/ssh/ directory doesnt't show any of those.

abarbarian
Posted
1 hour ago, securitybreach said:

That is something I have never seen or heard of.

 

Sign you are getting old if you missed that news 🤣

 

1 hour ago, securitybreach said:

My /etc/ssh/ directory doesnt't show any of those.

 

Have you not updated recently ?? 😛

 

My /etc/ssh has a ssh_config.d folder which is empty and a sshd_config.d folder which has one file 99-archlinux.conf containing,

 

# sshd_config defaults on Arch Linux
KbdInteractiveAuthentication no
UsePAM yes
PrintMotd no

 

Also ssh_config and sshd_config contain at the start of the file,

 

Quote

# Include drop-in configurations
Include /etc/ssh/ssh_config.d/*.conf

# This is the ssh client system-wide configuration file.  See
# ssh_config(5) for more information.  This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

 

 

Quote

# Include drop-in configurations
Include /etc/ssh/sshd_config.d/*.conf

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

 

Never thought I would ever be able to tell you something new about Arch. Better buy meself a lottery ticket. 😋

abarbarian
Posted
2 hours ago, wa4chq said:

I've used dd from the cli more times than I've used Imager program to set up RPi.. just be careful with it.   I'm setting up headless most of the times too.  The link shows how to setup SSH and wpa-supplicant.  This is how I do it the majority of the times.  On my phone, I use Fing to see it it's connecting. 

 

I gave up temporarily with ssh and connected to a monitor.

 

Thanks. I followed the guide in my first post using rpi-imager and accesing the pi through the monitor hostname,user,password and wireless all work I never checked the ssh side of things as I do not really know what to look for. So I am assuming that the problem is with my pc side of things and not with the guide I followed.

 

I was more interested in getting my pHat up and running and will look into the ssh stuff a bit later on if I need it. The link you gave suggests adding a ssh folder to the root of the pi so I may give that a go.

 

😎

securitybreach
Posted
20 minutes ago, abarbarian said:

Have you not updated recently ?? 😛

 

 

I update at least twice a day

securitybreach
Posted
Just now, securitybreach said:

 

I update at least twice a day

 

My VPS is only a 2 month old install and it doesn't have those either.

  • Like 1
abarbarian
Posted
44 minutes ago, securitybreach said:

I update at least twice a day

 

Are you sure you are running Arch ?? It is possible that I am running an Arch that has been sourced from another dimension as I seem to have entirely different results to almost every one else all the time. 🫣

abarbarian
Posted
4 hours ago, Hedon James said:

Since i need the IP address for ssh, now I log into my router and check it out there.

 

Well that tip certainly helped. In my router I can see that the pi is on-line and can see an ip addy for it.

Still can not connect from my own pc via ssh though.

 

😎

securitybreach
Posted
1 hour ago, abarbarian said:

 

Are you sure you are running Arch ?? It is possible that I am running an Arch that has been sourced from another dimension as I seem to have entirely different results to almost every one else all the time. 🫣

 

image.thumb.png.db42d6809ea2cc99a085ee88b09166c0.png

securitybreach
Posted
10 minutes ago, securitybreach said:

 

image.thumb.png.db42d6809ea2cc99a085ee88b09166c0.png

 

I only use sshd_config for server and ssh_config for client.

securitybreach
Posted

I have /etc/ssh/sshd_config.d/99-archlinux.conf but never set it up and its mostly blank.

abarbarian
Posted
11 hours ago, securitybreach said:

I have /etc/ssh/sshd_config.d/99-archlinux.conf but never set it up and its mostly blank.

 

The example I gave was the one that my Arch set up. I have never seen it before let alone added anything to it.😎

 

You do realise I was just pulling your leg regarding Arch 😛

  • Agree 1
abarbarian
Posted
14 hours ago, securitybreach said:

Only download the iso from https://archlinux.org/download/

 

 

Yeah you should always download any distro from the home site and really you should check/validate it with a checksum. 😎

  • Agree 1
securitybreach
Posted
43 minutes ago, abarbarian said:

 

The example I gave was the one that my Arch set up. I have never seen it before let alone added anything to it.😎

 

You do realise I was just pulling your leg regarding Arch 😛


Well I would hope so considering...

  • Haha 1
Posted
On 1/24/2024 at 5:06 AM, abarbarian said:

 

 and really you should check/validate it with a checksum. 😎

A wha'??  lol

  • Haha 2

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...