dedi.pi
Posts: 5
Joined: Mon Aug 06, 2018 2:04 pm

SOLVED Network unreachable after "PasswordAuthentication no"

Mon Aug 06, 2018 2:17 pm

Hello forum,

I m pretty new to raspbian and struggle a bit with SSH configuration.

Raspberry modell is 3b+.

I enabled SSH through raspi-config
and changed eth0 to static adress once this way:

Code: Select all

sudo nano /etc/dhcpcd.conf

                                    interface eth0
                                    static ip_address=192.168.8.25
                                    static routers=192.168.8.254
                                    static domain_name_servers=208.67.222.222 208.67.220.220       # OpenDNS
and once this way (DON T DO THIS - Thank you DirkS)

Code: Select all

sudo nano /etc/network/interfaces

                                    auto eth0
                                    iface eth0 inet static
                                            address 192.168.8.25
                                            netmask 255.255.255.0
                                            gateway 192.168.8.254
                                        
Both ways worked fine so far,
i added "ssh-copy-id" my rsa keys - login worked fine.

However, everytime i do this:

Code: Select all

echo "PasswordAuthentication no" | sudo tee -a /etc/ssh/sshd_config
the network (pi) becomes unreachable after reboot,
no matter wich configuration.

Without "PasswordAuthentication no" the pi remains reachable even after reboot.

It s a 2018-06-27-raspbian-stretch-lite fully updated.

Does anyone know how to fix it ?
Thank you in advance.





EDIT:

Turned out the guide i used was missing something like this:

Code: Select all

$ echo "PubkeyAuthentication yes" | sudo tee -a /etc/ssh/sshd_config
$ echo "RSAAuthentication yes" | sudo tee -a /etc/ssh/sshd_config



Still curious wich is the correct way to shutdown the pi in cli
and why "sudo poweroff" leaves LED s turned on.

Thank you Everyone !
Last edited by dedi.pi on Mon Aug 06, 2018 4:13 pm, edited 6 times in total.

Ernst
Posts: 1335
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Network unreachable after "PasswordAuthentication no"

Mon Aug 06, 2018 3:05 pm

You should never, repeat NEVER, hide the network mask.
Now have another look and you may see at least one of your mistakes.

and

You should never, repeat NEVER, hide RFC addresses. We want to see these.
The road to insanity is paved with static ip addresses

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

Re: Network unreachable after "PasswordAuthentication no"

Mon Aug 06, 2018 3:13 pm

Ernst wrote:
Mon Aug 06, 2018 3:05 pm
You should never, repeat NEVER, hide the network mask.
Now have another look and you may see at least one of your mistakes.

and

You should never, repeat NEVER, hide RFC addresses. We want to see these.
Eh?
This sounds as if the Pi did not boot because the data was hidden in the OP's post.
The only thing that happens is that we will have to ask for it.
No need for all the drama, especially since it's his first post...

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

Re: Network unreachable after "PasswordAuthentication no"

Mon Aug 06, 2018 3:18 pm

dedi.pi wrote:
Mon Aug 06, 2018 2:17 pm
and changed eth0 to static adress once this way:

Code: Select all

sudo nano /etc/dhcpcd.conf

                                    interface eth0
                                    static ip_address=192.168.xxx.xxx
                                    static routers=255.255.255.xxx
                                    static domain_name_servers=208.67.222.222 208.67.220.220       # OpenDNS
Your 'routers' line is wrong. You put a netmask there.
Most likely it's along those lines

Code: Select all

interface eth0
static ip_address=192.168.xxx.xxx/24
static routers=192.168.xxx.1 # IP address of your AP / router
static domain_name_servers=208.67.222.222 208.67.220.220       # OpenDNS
NB: don't make any modifications to your /etc/network/interfaces

dedi.pi
Posts: 5
Joined: Mon Aug 06, 2018 2:04 pm

Re: Network unreachable after "PasswordAuthentication no"

Mon Aug 06, 2018 3:23 pm

DirkS wrote:
Mon Aug 06, 2018 3:18 pm
dedi.pi wrote:
Mon Aug 06, 2018 2:17 pm
and changed eth0 to static adress once this way:

Code: Select all

sudo nano /etc/dhcpcd.conf

                                    interface eth0
                                    static ip_address=192.168.xxx.xxx
                                    static routers=255.255.255.xxx
                                    static domain_name_servers=208.67.222.222 208.67.220.220       # OpenDNS
Your 'routers' line is wrong. You put a netmask there.
Most likely it's along those lines

Code: Select all

interface eth0
static ip_address=192.168.xxx.xxx/24
static routers=192.168.xxx.1 # IP address of your AP / router
static domain_name_servers=208.67.222.222 208.67.220.220       # OpenDNS
NB: don't make any modifications to your /etc/network/interfaces
Thank you, i fixed the post, was a typo when writing this post.

I tried it a couple more times and found it might be connected to "sudo poweroff" and "sudo shutdown -h now".
Is it possible that these commands don t work like in vanilla debian / wich is the correct way ?
Last edited by dedi.pi on Mon Aug 06, 2018 4:58 pm, edited 1 time in total.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26716
Joined: Sat Jul 30, 2011 7:41 pm

Re: Network unreachable after "PasswordAuthentication no"

Mon Aug 06, 2018 3:32 pm

Ernst wrote:
Mon Aug 06, 2018 3:05 pm
You should never, repeat NEVER, hide the network mask.
Now have another look and you may see at least one of your mistakes.

and

You should never, repeat NEVER, hide RFC addresses. We want to see these.

Please keep things polite - first time posters can be easily frightened off, and we don't want a reputation of being aggressive or unfriendly to new users.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

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

Re: Network unreachable after "PasswordAuthentication no"

Mon Aug 06, 2018 3:45 pm

dedi.pi wrote:
Mon Aug 06, 2018 3:23 pm
I tried it a couple more times and found it might be connected to "sudo poweroff" and "sudo reboot".
Is it possible that these commands don t work like in vanilla debian / wich is the correct way ?
Sorry, what do you mean by this? Do you think the poweroff / reboot commands do not work?
Some people have reported problems in certain circumstances, but personally I have never had any problems with them.

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

Re: Network unreachable after "PasswordAuthentication no"

Mon Aug 06, 2018 3:47 pm

BTW: As @Ernst remarked: there is no need to mask local IP addresses.
It just makes things harder for users trying to help.

dedi.pi
Posts: 5
Joined: Mon Aug 06, 2018 2:04 pm

Re: Network unreachable after "PasswordAuthentication no"

Mon Aug 06, 2018 3:56 pm

DirkS wrote:
Mon Aug 06, 2018 3:45 pm
dedi.pi wrote:
Mon Aug 06, 2018 3:23 pm
I tried it a couple more times and found it might be connected to "sudo poweroff" and "sudo reboot".
Is it possible that these commands don t work like in vanilla debian / wich is the correct way ?
Sorry, what do you mean by this? Do you think the poweroff / reboot commands do not work?
Some people have reported problems in certain circumstances, but personally I have never had any problems with them.
Yes, "sudo shutdown -h now", "sudo poweroff" and "sudo systemctl poweroff"
look like a shutdown on HDMI but green, red and USB-Stick LED s remain active.
( "sudo reboot" works fine - my fault )

Atm my Raspbian Lite doesn t have any changes despite from localisation and SSH settings.
DirkS wrote:
Mon Aug 06, 2018 3:47 pm
BTW: As @Ernst remarked: there is no need to mask local IP addresses.
It just makes things harder for users trying to help.
Ok, i changed it.
Doesn t really play a role in this case though - since the setups DO work without the password-related changes.

And just incase - No, there are no (other) DHCP-Devices competing for ip s.

User avatar
DougieLawson
Posts: 39304
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Network unreachable after "PasswordAuthentication no"

Tue Aug 07, 2018 5:13 pm

DirkS wrote:
Mon Aug 06, 2018 3:47 pm
BTW: As @Ernst remarked: there is no need to mask local IP addresses.
It just makes things harder for users trying to help.
It doesn't hurt to mask or not mask. If addresses are masked I'm just going to assume the RPi is 192.168.3.14 the router is 192.168.3.1 or 192.168.3.254 and the netmask is 255.255.255.0 (or /24 in CIDR).

The key is that the address and the gateway are in the same subnet, regardless of which subnet is being used. Hiding the mask is more of a pain than hiding the address (I found a 192.168.xxx.xxx network with a /20 netmask in one building I was in).
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “Beginners”