Page 1 of 1

SSH into Odroid XU4

Posted: Sun Apr 21, 2019 8:35 am
by automaton
Hi all,

I'm new to the forum! I'm not currently able to ssh into my odroid and haven't been able to find a solution based on existing threads.

I just got started with my Odroid XU4 running 18.04. I've interfaced with a number of Linux VMs in the past, but haven't messed with administration and general server setup before.

My odroid is connected to to the same wifi network as my machine that I'm trying to ssh from. I got the IP address of the odroid by running

Code: Select all

 curl ifconfig.me 
from the CLI. When I do either

Code: Select all

 ssh odroid@xxx.xxx.xxx.xxx 
or

Code: Select all

 ssh root@... 
I get "Permission denied (publickey,password)". Now I've seen this in MANY threads, but I haven't found a solution that works for me.

Here's what I've done:
1) I changed the PermitRootLogin in /etc/ssh/sshd_config to yes. Here is my sshd_config file.

Code: Select all

 #	$OpenBSD: sshd_config,v 1.101 2017/03/14 07:19:07 djm Exp $

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

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

PubkeyAuthentication yes

# Expect .ssh/authorized_keys2 to be disregarded by default in future.
AuthorizedKeysFile	/home/odroid/.ssh/authorized_keys

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
#PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

#	$OpenBSD: sshd_config,v 1.101 2017/03/14 07:19:07 djm Exp $

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

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

PubkeyAuthentication yes

# Expect .ssh/authorized_keys2 to be disregarded by default in future.
AuthorizedKeysFile	/home/odroid/.ssh/authorized_keys

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
#PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

# override default of no subsystems
Subsystem	sftp	/usr/lib/openssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#	X11Forwarding no
#	AllowTcpForwarding no
#	PermitTTY no
#	ForceCommand cvs server 
2) I've also messed around with the AuthorizedKeysFile directory as I added my laptop's public id_rsa to ~/.ssh/authorized_keys but that didn't solve it either.
3) A slightly different approach I've taken is setting up the an AP from the Odroid using create_ap but that wasn't a fruitful path either (I can elaborate more on this if this is something I should be doing).

My hardware setup is that I have two wifi dongles attached to the Odroid currently. One will access the internet generally and the other will create an AP so that I can ssh in even when there isn't an existing network that my Odroid has credentials for.

Thanks!

Re: SSH into Odroid XU4

Posted: Sun Apr 21, 2019 8:38 am
by meveric
automaton wrote:
Sun Apr 21, 2019 8:35 am
2) I've also messed around with the AuthorizedKeysFile directory as I added my laptop's public id_rsa to ~/.ssh/authorized_keys but that didn't solve it either.
I hope you meant "id_rsa.pub" as the other is the "private key" which should never be "shared".
Only if you add the public key it will work.

Re: SSH into Odroid XU4

Posted: Sun Apr 21, 2019 10:07 am
by automaton
Yes .pub. I should have been precise!

Re: SSH into Odroid XU4

Posted: Sun Apr 21, 2019 3:09 pm
by mad_ady
curl ifconfig.me returns your network's public address. Chances are your lan is behind NAT so the public ip you're seeing is your router's. Try with your router credentials to test.
To find out your odroid's private ip run ip addr show in it's shell.

Re: SSH into Odroid XU4

Posted: Mon Apr 22, 2019 9:59 am
by automaton
Thanks for the pointer. That in conjunction with some incorrect lines in my sshd_config resolved it!

As a follow up, my understanding is that I need to have two antenna if I want to create an AP (for when I don't have a monitor or a known network for my odroid). Do I basically create a startup bash script so that an AP is created on boot and then if I switch to that lan on another machine, I can ssh in? Or what's the canonical solution?

Re: SSH into Odroid XU4

Posted: Mon Apr 22, 2019 11:37 am
by joshua.yang
I'm not sure AP mode can be as SSH access point.

Just to monitor your device, you can connect to that using SSH to the only private IP address the device has, which is shown 192.168.0.x usually.