mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-09-24 16:54:03 +00:00
fix(xcat-core): the el10 Genesis image gives root the home directory /root
Every case that boots a node into the el10 legacy Genesis image fails with "root@<cn>: Permission denied (publickey,password,keyboard-interactive)". mknb writes the management node key to /.ssh/authorized_keys, and sshd looks for it under the home directory of root. The dracut cmdline hook deletes the root entry the image ships with "sed -i '/^root:x/d'" and appends its own entry with the home directory /. dracut 99base writes that entry, and from dracut 060 the password field holds x only when the image is built --hostonly. The Genesis image is built with -N, so el10 (dracut 107) ships "root::0:0::/root:/bin/sh". The delete does not match, two root entries survive, and getpwnam returns the first one. el8 (dracut 049) and el9 (dracut 057) always ship the x and are not affected. The delete now matches the user name only. All three cmdline hooks carry the same statement and all three change. genesis_root_home.t runs the rewrite against both entry shapes and fails on the empty password field without this change. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
@@ -22,7 +22,9 @@ echo PS1="'"'[xCAT Genesis running on \H \w]\$ '"'" > /.bash_profile
|
||||
mkdir -p /etc/ssh
|
||||
mkdir -p /var/tmp/
|
||||
mkdir -p /var/empty/sshd
|
||||
sed -i '/^root:x/d' /etc/passwd
|
||||
# dracut writes this entry itself, with an empty password field unless the image is
|
||||
# built --hostonly. Match the user name only.
|
||||
sed -i '/^root:/d' /etc/passwd
|
||||
cat >>/etc/passwd <<"__ENDL"
|
||||
root:x:0:0::/:/bin/bash
|
||||
sshd:x:30:30:SSH User:/var/empty/sshd:/sbin/nologin
|
||||
|
||||
@@ -22,7 +22,9 @@ echo PS1="'"'[xCAT Genesis running on \H \w]\$ '"'" > /.bash_profile
|
||||
mkdir -p /etc/ssh
|
||||
mkdir -p /var/tmp/
|
||||
mkdir -p /var/empty/sshd
|
||||
sed -i '/^root:x/d' /etc/passwd
|
||||
# dracut writes this entry itself, with an empty password field unless the image is
|
||||
# built --hostonly. Match the user name only.
|
||||
sed -i '/^root:/d' /etc/passwd
|
||||
cat >>/etc/passwd <<"__ENDL"
|
||||
root:x:0:0::/:/bin/bash
|
||||
sshd:x:30:30:SSH User:/var/empty/sshd:/sbin/nologin
|
||||
|
||||
@@ -8,7 +8,9 @@ echo PS1="'"'[xCAT Genesis running on \H \w]\$ '"'" > /.bash_profile
|
||||
mkdir -p /etc/ssh
|
||||
mkdir -p /var/tmp/
|
||||
mkdir -p /var/empty/sshd
|
||||
sed -i '/^root:x/d' /etc/passwd
|
||||
# dracut writes this entry itself, with an empty password field unless the image is
|
||||
# built --hostonly. Match the user name only.
|
||||
sed -i '/^root:/d' /etc/passwd
|
||||
cat >>/etc/passwd <<"__ENDL"
|
||||
root:x:0:0::/:/bin/bash
|
||||
sshd:x:30:30:SSH User:/var/empty/sshd:/sbin/nologin
|
||||
|
||||
Reference in New Issue
Block a user