fix
This commit is contained in:
parent
666cacbf0d
commit
19da9aa17a
25
preseed.cfg
25
preseed.cfg
@ -106,14 +106,35 @@ d-i preseed/late_command string \
|
|||||||
HOST_SERIAL="debian-$(head /dev/urandom | tr -dc a-z | head -c10)" ; \
|
HOST_SERIAL="debian-$(head /dev/urandom | tr -dc a-z | head -c10)" ; \
|
||||||
sed -i "s/unassigned-preseed/$HOST_SERIAL/g" /target/etc/hostname ; \
|
sed -i "s/unassigned-preseed/$HOST_SERIAL/g" /target/etc/hostname ; \
|
||||||
sed -i "s/unassigned-preseed/$HOST_SERIAL/g" /target/etc/hosts ; \
|
sed -i "s/unassigned-preseed/$HOST_SERIAL/g" /target/etc/hosts ; \
|
||||||
in-target sh -c 'mkdir -pv --mode=0700 /root/.ssh'; \
|
in-target sh -c 'mkdir -pv /root/.ssh'; \
|
||||||
|
in-target chmod 0700 /root/.ssh/authorized_keys
|
||||||
in-target sh -c 'echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC8flq0BNF/ijRyWJVoF0RgP7VmgO3JhZUB6fbIEPhN3uImfCyn8X5U8cQOBZ8jn5F4eAkpFu/9K4c/bqrMKtapcHg8uIXJjyYW2otsw+tO6OkPcjOQKL2rpSuDa8fPHFvQuA1xJE/qO/IpdW6hGgWg8nFeLxJ+dE5b6QXszIr4q39iMKRcgWKoWy5PEd1KmHYt7WvwsgpcnKCCQTUnxHWrRljM/IgzQ7zjVZ1/8uUPYjqDzc11bN6lUwSEGLiYuVKdyus9osiPJlKwFr+rdxZhqrgErZlffgEpG+oi5yE0YynbJSloqsy7kQVzon0c9pyixQnBvJ58IHtgWXmlPPVswT11MgpIhSO8suPmmJ41f89Y7d/jDuqEeUu/pfJ3OW3O4AvYHxlQlRMFT3r+SOt0BvI1nUocYaashlB3+6zpDwkHU5WaC00u30s+0lfZ1fQ4EEE4rYKTztHgpk/BVS5Z5f+vG/gMOC7W7E0kVCFmRz3ZPc30MVq7WtV2pS6fQ5U= XkingServer" > /root/.ssh/authorized_keys'; \
|
in-target sh -c 'echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC8flq0BNF/ijRyWJVoF0RgP7VmgO3JhZUB6fbIEPhN3uImfCyn8X5U8cQOBZ8jn5F4eAkpFu/9K4c/bqrMKtapcHg8uIXJjyYW2otsw+tO6OkPcjOQKL2rpSuDa8fPHFvQuA1xJE/qO/IpdW6hGgWg8nFeLxJ+dE5b6QXszIr4q39iMKRcgWKoWy5PEd1KmHYt7WvwsgpcnKCCQTUnxHWrRljM/IgzQ7zjVZ1/8uUPYjqDzc11bN6lUwSEGLiYuVKdyus9osiPJlKwFr+rdxZhqrgErZlffgEpG+oi5yE0YynbJSloqsy7kQVzon0c9pyixQnBvJ58IHtgWXmlPPVswT11MgpIhSO8suPmmJ41f89Y7d/jDuqEeUu/pfJ3OW3O4AvYHxlQlRMFT3r+SOt0BvI1nUocYaashlB3+6zpDwkHU5WaC00u30s+0lfZ1fQ4EEE4rYKTztHgpk/BVS5Z5f+vG/gMOC7W7E0kVCFmRz3ZPc30MVq7WtV2pS6fQ5U= XkingServer" > /root/.ssh/authorized_keys'; \
|
||||||
in-target chown --recursive root:root /root/.ssh; \
|
in-target chown --recursive root:root /root/.ssh; \
|
||||||
in-target chmod 0600 /root/.ssh/authorized_keys; \
|
in-target chmod 0600 /root/.ssh/authorized_keys; \
|
||||||
in-target update-alternatives --set editor /usr/bin/vim.basic; \
|
in-target update-alternatives --set editor /usr/bin/vim.basic; \
|
||||||
in-target sed -i -e 's/^\(PasswordAuthentication\).*/\1 yes/g' -e 's/^\(PermitRootLogin\).*/\1 yes/g' /etc/ssh/sshd_config; \
|
in-target sed -i -e 's/^\(PasswordAuthentication\).*/\1 yes/g' -e 's/^\(PermitRootLogin\).*/\1 yes/g' /etc/ssh/sshd_config; \
|
||||||
in-target sed -i -e '/^GRUB_HIDDEN_TIMEOUT=/d' -e 's/^\(GRUB_HIDDEN_TIMEOUT_QUIET\)=true/\1=false/' /etc/default/grub; \
|
in-target sed -i -e '/^GRUB_HIDDEN_TIMEOUT=/d' -e 's/^\(GRUB_HIDDEN_TIMEOUT_QUIET\)=true/\1=false/' /etc/default/grub; \
|
||||||
in-target sh -c 'echo "dhclient -6 eth0; exit 0" >>/etc/rc.local' ;\
|
in-target sh -c '
|
||||||
|
cat <<EOF >/etc/rc.local
|
||||||
|
#!/bin/sh -e
|
||||||
|
#
|
||||||
|
# rc.local
|
||||||
|
#
|
||||||
|
# This script is executed at the end of each multiuser runlevel.
|
||||||
|
# Make sure that the script will "exit 0" on success or any other
|
||||||
|
# value on error.
|
||||||
|
#
|
||||||
|
# In order to enable or disable this script just change the execution
|
||||||
|
# bits.
|
||||||
|
#
|
||||||
|
# By default this script does nothing.
|
||||||
|
|
||||||
|
dhclient -6 eth0
|
||||||
|
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
EOF
|
||||||
|
' ;\
|
||||||
in-target chmod +x /etc/rc.local; \
|
in-target chmod +x /etc/rc.local; \
|
||||||
in-target systemctl enable --now sshd; \
|
in-target systemctl enable --now sshd; \
|
||||||
in-target systemctl enable --now rc-local; \
|
in-target systemctl enable --now rc-local; \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user