web-dev-qa-db-ja.com

(centOS)cloud-initがsshをプルしていません

OpenStackガイドを使用してCentOS6 qcow2イメージをビルドしようとしています[ http://docs.openstack.org/image-guide/content/centos-image.html] 。 「/etc/rc.d/rc.local」スクリプトの代わりに「cloud-init」を使用していますが、「cloud-init」がスクリプトをオーバーライドすると思いますか?イメージを正常に作成し、インスタンスをアップロードして作成しました。しかし、それにsshすることはできません。インスタンスがOpenStackサーバー/コントローラーからssh公開鍵をプルしていないようです。

[更新:パスワードでsshを許可して別の方法を試す]

これらは、OpenStack管理ページから取得したログです。

ci-info: ++++++++++++++++++++++++++++++Route info++++++++++++++++++++++++++++++
ci-info: +-------+-------------+----------+---------------+-----------+-------+
ci-info: | Route | Destination | Gateway  |    Genmask    | Interface | Flags |
ci-info: +-------+-------------+----------+---------------+-----------+-------+
ci-info: |   0   |   10.6.1.0  | 0.0.0.0  | 255.255.255.0 |    eth0   |   U   |
ci-info: |   1   |   0.0.0.0   | 10.6.1.1 |    0.0.0.0    |    eth0   |   UG  |
ci-info: +-------+-------------+----------+---------------+-----------+-------+
Starting cloud-init: Cloud-init v. 0.7.5 running 'modules:config' at Thu, 05 Nov 2015 23:55:05 +0000. Up 15.43 seconds.
Starting cloud-init: Cloud-init v. 0.7.5 running 'modules:final' at Thu, 05 Nov 2015 23:55:06 +0000. Up 17.00 seconds.
ci-info: ++++++++++Authorized keys from /home/centos/.ssh/authorized_keys for user centos+++++++++++
ci-info: +---------+-------------------------------------------------+---------+-------------------+
ci-info: | Keytype |                Fingerprint (md5)                | Options |      Comment      |
ci-info: +---------+-------------------------------------------------+---------+-------------------+
ci-info: | ssh-rsa | d7:78:f4:82:71:f8:cd:4e:75:d9:ca:fd:57:f6:74:82 |    -    | Generated-by-Nova |
ci-info: +---------+-------------------------------------------------+---------+-------------------+
ec2: 
ec2: #############################################################
ec2: -----BEGIN SSH Host KEY FINGERPRINTS-----
ec2: 1024 a2:e1:7a:5d:9a:2b:83:4e:a8:07:90:6b:a2:9a:bf:19 /etc/ssh/ssh_Host_dsa_key.pub (DSA)
ec2: 2048 8b:fc:3e:4a:a3:bb:3c:52:3f:a0:13:56:29:7a:d6:bb /etc/ssh/ssh_Host_key.pub (RSA1)
ec2: 2048 6e:c2:99:cd:59:98:a3:d9:06:1c:ae:f9:d1:e6:56:10 /etc/ssh/ssh_Host_rsa_key.pub (RSA)
ec2: -----END SSH Host KEY FINGERPRINTS-----
ec2: #############################################################
-----BEGIN SSH Host KEY KEYS-----
2048 35 32313190688033058191298985530558350409552981243503755532029861426754427614850471780051595180844003086009 
ssh-rsa 888WVD3T7cf/CN94GG4bLV66NIedXmdit1fpRxEOx7idyCOXsfi/53D7Lo7Ez+kqZAe4HGo0JSQ== 
-----END SSH Host KEY KEYS-----
Cloud-init v. 0.7.5 finished at Thu, 05 Nov 2015 23:55:06 +0000. Datasource DataSourceConfigDriveNet [net,ver=2][source=/dev/sr0].  Up 17.20 seconds
Starting postfix: [  OK  ]
Starting crond: [  OK  ]

CentOS release 6.6 (Final)
Kernel 2.6.32-504.el6.x86_64 on an x86_64

demo-centos login: 

これらはいくつかの重要なファイルの私の設定ファイルです。編集した「cloud.cfg」でインスタンスが起動しない別のファイルに入れる必要がありますか?

[/etc/sudoers]

##
## Allow root to run any commands anywhere 
root    ALL=(ALL)       ALL
centos ALL = (ALL) NOPASSWD: ALL
## Allows members of the 'sys' group to run networking, software, 
## service management apps and more.
# %sys ALL = NETWORKING, SOFTWAR

[/etc/cloud/cloud.cfg]

system_info:
  default_user:
    name: centos
    lock_passwd: true
    gecos: Cloud User
    groups: [wheel, adm]
    Sudo: ["ALL=(ALL) NOPASSWD:ALL"]
    Shell: /bin/bash
  distro: rhel
  paths:

password: centos
chpasswd: { expire: False }
ssh_pwauth: True

コンソールも機能していません。慰めるための正しい行を追加しましたか?

[/boot/grub/menu.lst]
   grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/sda3
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
serial --unit=0 --speed=115200
terminal --timeout=10 console serial
hiddenmenu
title CentOS 6 (2.6.32-504.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-504.el6.x86_64 ro root=UUID=a396de13-a505-4356-be47-14e9e600b9f9 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-Sun16 crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet console=tty0 console=ttyS0,115200n8
        initrd /initramfs-2.6.32-504.el6.x86_64.img

編集した「cloud.cfg」でインスタンスが起動しない別のファイルに入れる必要がありますか?これにより、パスワード「centos」で「sshcentos @ ip-address」が有効になりますか?

私の質問が関連しているようには見えません OpenstackのCentos vmにSSH接続できません

OpenStackqcow構成ファイルは非常に扱いにくいです。構文は正確な形式である必要があります。 (間隔など)。

[/etc/cloud/cloud.cfg]

system_info:
  default_user:
    name: centos
    lock_passwd: true
    gecos: Cloud User
    groups: [wheel, adm]
    Sudo: ["ALL=(ALL) NOPASSWD:ALL"]
    Shell: /bin/bash
  distro: rhel
  paths:

password: centos
chpasswd: { expire: False }
ssh_pwauth: True

[/boot/grub/menu.lst-動作しました]

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/sda3
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
serial --unit=0 --speed=115200
terminal --timeout=10 console serial
hiddenmenu
title CentOS 6 (2.6.32-504.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-504.el6.x86_64 ro root=UUID=a396de13-a505-4356-be47-14e9e600b9f9 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-Sun16 crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet console=tty0 console=ttyS0,115200n8
        initrd /initramfs-2.6.32-504.el6.x86_64.img

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/sda2
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
serial --unit=0 --speed=115200
terminal --timeout=10 console serial
hiddenmenu
title CentOS 6 (2.6.32-504.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-504.el6.x86_64 ro root=UUID=93432822-56e1-4f94-91f3-60fd80b9bfb1 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-Sun16 crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet console=tty0 console=ttyS0,115200n8
        initrd /initramfs-2.6.32-504.el6.x86_64.img

[BAM]

  ci-info: +-------+-------------+----------+---------------+-----------+-------+
ci-info: | Route | Destination | Gateway  |    Genmask    | Interface | Flags |
ci-info: +-------+-------------+----------+---------------+-----------+-------+
ci-info: |   0   |   10.6.1.0  | 0.0.0.0  | 255.255.255.0 |    eth0   |   U   |
ci-info: |   1   | 169.254.0.0 | 0.0.0.0  |  255.255.0.0  |    eth0   |   U   |
ci-info: |   2   |   0.0.0.0   | 10.6.1.1 |    0.0.0.0    |    eth0   |   UG  |
ci-info: +-------+-------------+----------+---------------+-----------+-------+
Starting cloud-init: Cloud-init v. 0.7.5 running 'modules:config' at Fri, 13 Nov 2015 22:07:32 +0000. Up 27.57 seconds.
Starting cloud-init: Cloud-init v. 0.7.5 running 'modules:final' at Fri, 13 Nov 2015 22:07:33 +0000. Up 29.43 seconds.
ci-info: ++++++++++Authorized keys from /home/centos/.ssh/authorized_keys for user centos+++++++++++
ci-info: +---------+-------------------------------------------------+---------+-------------------+
ci-info: | Keytype |                Fingerprint (md5)                | Options |      Comment      |
ci-info: +---------+-------------------------------------------------+---------+-------------------+
ci-info: | ssh-rsa | d7:78:f4:82:71:f8:cd:4e:75:d9:ca:fd:57:f6:74:82 |    -    | Generated-by-Nova |
ci-info: +---------+-------------------------------------------------+---------+-------------------+
ec2: 
ec2: #############################################################
ec2: -----BEGIN SSH Host KEY FINGERPRINTS-----
ec2: 1024 52:ef:33:97:49:d5:ac:b0:5a:59:7f:8f:80:f1:9e:d9 /etc/ssh/ssh_Host_dsa_key.pub (DSA)
ec2: 2048 4d:9f:c3:05:cc:9a:3b:37:c5:0a:27:8e:08:9c:e8:61 /etc/ssh/ssh_Host_key.pub (RSA1)
ec2: 2048 41:e7:fd:3d:b4:26:b3:cb:6f:f8:cb:6a:31:60:92:94 /etc/ssh/ssh_Host_rsa_key.pub (RSA)
ec2: -----END SSH Host KEY FINGERPRINTS-----
ec2: #############################################################
-----BEGIN SSH Host KEY KEYS-----
2048 35 28659583872114087976099838274719927140869079419780503337263195789109684665038761091997527137778426128641191506639125305991400855664175743627494850540768477052209487077522869031392495953447137918345409881017192368218757431758100317916696564401124818390566713036518484896494211408975565244454688550594124991034514079830180604880730593285771111372620489778017011638099267706767457481638139820921787639093793302084558052828243864932651608547548031101579125369522449801180176680832871839949766902603409803129900827570886216824503573705610909511994034019630804614616397546233173185123668523788122205977816079499308671859391 
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAuRXdwPAl+Rs4MAJL1aXAgxUU0EVae74iI3m32uu27UYz9xBDmiDWlVwA2XwQkP/6MXBaAihW8ckBwsXSBaty400WifVfcam/HQ4eVHkV17U/48OFybGL5OjM03BBjvuBpidV1okLXSA4WOiEJiAGt8LQrh5925Y5unRN5HjX/RUBXLwzCg6LEStyQDjIbVf78LBdgpljwkgsef4fjYoDoLRxOeGjzT4P7eMYolNpKyQgLM+lMtBsmjAjA3hx+vLryjOjQ7qFmtAbbJBsvhUOj79xrOefcdzUGt8ctnE8C+Cf6eXStcifWRjEm1GcQjaVOcd5wJHnqP1o/+/+qqj/cw== 
-----END SSH Host KEY KEYS-----
Cloud-init v. 0.7.5 finished at Fri, 13 Nov 2015 22:07:34 +0000. Datasource DataSourceConfigDriveNet [net,ver=2][source=/dev/sr0].  Up 29.63 seconds
Starting postfix: [  OK  ]
Starting crond: [  OK  ]

CentOS release 6.6 (Final)
Kernel 2.6.32-504.el6.x86_64 on an x86_64