FX30 Yocto : add new user

Hi,

I am currently trying to create a user (let’s call it “sshuser”) to be used for SSH connection, instead of directly having the root user “exposed”.

I managed to create the user, but when I am connecting to my FX30 over SSH with “sshuser”, the connection is successful but instantly closed.

While looking what was wrong, I found out that the home directory of “sshuser” was missing. I had “/home/root”, “/home/admin” but no “/home/sshuser”. However, when looking into the rootfs resulting of the build of my custom Yocto image for FX30, I can see “/home/root” and “/home/sshuser”, but there is no “/home/admin”.

Once “/home/sshuser” manually created on the FX30, I can then successfully log in over SSH using “sshuser”.

Two questions :
1 : Why is “/home/sshuser” missing on my FX30 and how to fix it without having to manually create it ?
2 : Where does “/home/admin” come from ?

Thank you in advance for your answer.

Best regards,
Sami

you can see here:

after “useradd -m sshuser”, /home/sshuser will be created.

Hi,

My user is created by inheriting “extrausers” in my image append of mdm9x28-image-minimal in Yocto and passing the required “EXTRA_USERS_PARAMS”.

My user is created, is present in “/etc/passwd”, only the home directory is missing when the image is flashed on the FX30.

My question is about why is the user’s home directory not present.

Still, thank you for your quick answer.

Best regards,
Sami

how do you set “EXTRA_USERS_PARAMS”?

BTW, see if this helps:

Here is what my “mdm9x28-image-minimal.bbappend” looks like :

inherit extrausers

EXTRA_USERS_PARAMS = " \
    usermod -p '{ROOT_HASHED_PASSWORD}' root; \
    useradd -p '{SSHUSER_HASHED_PASSWORD}' sshuser;
"

IMAGE_INSTALL += "openvpn"

IMAGE_FEATURES_remove += "debug-tweaks"
IMAGE_FEATURES_remove += "allow-empty-password"

Didn’t you need to add -m option?

1 Like

I tried adding “-m” to my “useradd” command, and it looks like it was the missing part. I am a bit surprised, as “/home/sshuser” was present in the built rootfs.tar.bz on my host machine, but it works.

As always, thank you for the quick replies @jyijyi !

I now have a question about disabling factory reset by default. Should I create a new topic ?

Thank you again,
Sami

yes, better create new topic

1 Like