SpecialistOff.NET / Вопросы / Статьи / Фрагменты кода / Резюме / Метки / Помощь / Файлы

Список вопросов Печать

Пересборка образа CentOS 6


Метки: centos dsa rsa 

Ответы

RemiZOffAlex  Создано: 2017-06-11 00:37:51.639547  Обновлено: 2017-06-11 00:37:51.639547
# Загрузка
wget http://mirror.yandex.ru/centos/6/os/x86_64/images/pxeboot/vmlinuz
wget http://mirror.yandex.ru/centos/6/os/x86_64/images/pxeboot/initrd.img

# Распаковка
mkdir initrd-new
mv initrd.img initrd.img.xz
xz --format=lzma initrd.img.xz --decompress
pushd initrd-new
cpio -ivdum < ../initrd.img

# Изменения
cat << EOF > etc/ssh/authorized_keys
EOF

cat << EOF > etc/ssh/sshd_config.anaconda
Protocol 2
Port 22
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
PermitRootLogin yes
IgnoreRhosts yes
StrictModes yes
X11Forwarding yes
X11DisplayOffset 10
PrintMotd yes
XAuthLocation /sbin/xauth
KeepAlive yes
SyslogFacility AUTHPRIV
RSAAuthentication yes
PasswordAuthentication yes
# PermitEmptyPasswords yes
PermitUserEnvironment yes
AuthorizedKeysFile /etc/ssh/authorized_keys
EOF

cat << EOF >
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ''
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ''
/bin/sshd -f /etc/ssh/sshd_config.anaconda
EOF

# Сборка
find . -print |cpio -o -H newc | xz --format=lzma > ../initrd.img
popd

Возможно будут интересны и другие вопросы