SSH fail after adding root user password

Hi,

After adding root user password into local.conf file like:

INHERIT += "extrausers"
EXTRA_USERS_PARAMS = "usermod -P my_password root;"

It become impossible to make SSH connection to the board anymore.

However via the UART terminal root login is now with new password and login there is OK.

Every try to log via ssh asks for password but when enter newly defined password (the same password that works via the UART terminal) for root user it always fail:

ssh root@192.168.1.149 
Password: 
packet_write_wait: Connection to 192.168.1.149 port 22: Broken pipe

Before adding password to root user (default Toradex configuration) SSH connection as root was perfect.

Do you have any idea why adding root user password caused the shh connection not to work anymore?

Thanks,

BR

Hi

Have a look here.

Max

Thanks Max.

Just to notice, the link was partially helpful, because actual issue was parameter :

"PermitRootLogin yes "

in /etc/ssh/sshd_config configuration file.

By some strange logic when there is NO root pass word at all this value does not affect and connection is possible. However when root password is added it takes effect and no longer ssh is possible.

To help someone else with similar problem also have to set:
"ChallengeResponseAuthentication no "

By default is “yes” and needs additional password authentication different than root password defined.

BR,
Kaloian

Thanks, this solved my problem.

hi @rogersguedes: Your are welcome. What did help your problem, the answer of Max or the comment of kaloianpenev. Best regards, Jaski

Hi, Thanks! :slight_smile:
The comment of @kaloianpenev .

Ok, Perfect. Thanks for the feedback.

Hello ,
Now i am able to login into root without anypassword.
But i want to enable root password :
SO i modfied the followin in my local.conf file :

# EXTRA_IMAGE_FEATURES ?="debug-tweaks"
EXTRA_IMAGE_FEATURES=""
INHERIT += "extrausers"
EXTRA_USERS_PARAMS = "usermod -p abcde root"

My sshuser.bb file :

echo "user1 ALL=(ALL) PASSWD:ALL" >> ${D}${sysconfdir}/sudoers.d/user1

My sshd_config file has the following configurations :

PermitRootLogin no
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication no
#PermitEmptyPasswords no
ChallengeResponseAuthentication no

Now when i try to login using “sudo -i”
i am able to login directly.

What changes have to done to enable password for root login.

Thanks,
Meghana

Hi @meghana

Your question is handled in your separate thread.

Best regards
Diego

Thank you kaloianpenev.

I had the same problem and spent many days trying to solve it. I was able to find a solution through the “permitRootLogin” you showed. In addition, Toradex engineer has found a way to modify it in Yocto. If someone wants to apply it to Yocto image, do the following.

r@p:~$ find . -name "*sshd_config*"
./meta-angstrom/recipes-tweaks/openssh/files/sshd_config
./openembedded-core/meta/recipes-connectivity/openssh/openssh/sshd_config

I found that the sshd_config in SOM and the sshd_config in the meta-angstrom folder were the same. Open this sshd_config and modify as follows.

./meta-angstrom/recipes-tweaks/openssh/files/sshd_config
#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

Build and burn the image to your SOM.

r@p:~$ bitbake -k console-tdx-image