はじめに
この文書はNetBSD Advent Calendar 2015の15日目の記事として書かれました。
pkgsrcは、NetBSDの公式パッケージシステムです。このパッケージシステムの特徴として、他のUN*X系OSでも使うことができます。[1]
たとえば、少し前まで、DragonFly BSDが、pkgsrcを公式パッケージシステムにしていました。また、Node.jsで有名な、JoyentのつくるクラウドOS、SmartOSが公式パッケージシステムとして利用しています。[2]
さて、このJoyentは、https://pkgsrc.joyent.com/ というサイトをつくっていて、ここで、SmartOSを始め、Illumos・OpenIndiana・OmniOSといったOpenSolaris系のOSのためのバイナリーパッケージを提供しています。
そればかりではなく、OS Xと、RHEL6互換OSむけのバイナリーパッケージも提供しています。これらOSは、いずれも、最新のフリーソフトを利用しようとしても、公式パッケージのアップデートがなかったり、そもそもフリーソフトを導入するパッケージシステムがなかったり、乏しかったりするものです。
この文書では、CentOS6でJoyentが提供するpkgsrcのバイナリーパッケージを使ってみます。
なお、pkgsrcの基本的なこと(たとえば、pkg_*コマンドのこと等)は割愛します。(別に知らなくても使えると思いますが、少しは「用語」は出てきちゃうので...。)
バイナリーパッケージって信用していいの?
...という話も最近聞かなくなりましたね。
ようは、バイナリーパッケージ=コンパイル済なので、どんな悪意ある改変が行われていてもわからない。ゆえに、ソースからのインストール(=ふつうにpkgsrcからmake install)すべき、という話です。
よって、以下の話は、Joyentを信用できる人だけの話、です。ねんのため。
(Joyent版)pkgsrcの導入
前提
https://pkgsrc.joyent.com/install-on-linux/ にとてもかんたんに書いてあって、実際、だいたいこのとおりなのですが、やってみます。
今回は、旧ConoHaのメモリ1GプランのCentOS 6.5で試してみることにします。
bootstrapのインストール
bootstrapをダウンロード、インストールします。
- https://pkgsrc.joyent.com/packages/Linux/bootstrap/bootstrap-trunk-x86_64.tar.gz
- https://pkgsrc.joyent.com/packages/Linux/bootstrap/bootstrap-trunk-x86_64.tar.gz.asc
の2つのファイルをダウンロードします。
ダウンロードしたら、正しいバイナリかどうか、検証します。OS Xのページに、gpgを使った検証方法が載っています。
# gpg --recv-keys 0xDE817B8E gpg: directory `/root/.gnupg' created gpg: new configuration file `/root/.gnupg/gpg.conf' created gpg: WARNING: options in `/root/.gnupg/gpg.conf' are not yet active during this run gpg: keyring `/root/.gnupg/secring.gpg' created gpg: keyring `/root/.gnupg/pubring.gpg' created gpg: no keyserver known (use option --keyserver) gpg: keyserver receive failed: Syntax error in URI
一番最初だけ、(よくわかりませんが)失敗します。
# gpg --recv-keys 0xDE817B8E gpg: requesting key DE817B8E from hkp server keys.gnupg.net gpg: /root/.gnupg/trustdb.gpg: trustdb created gpg: key FAA66EE0: public key "Joyent Package Signing <pkgsrc@joyent.com>" imported gpg: no ultimately trusted keys found gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) # gpg --verify bootstrap-trunk-x86_64.tar.gz.asc bootstrap-trunk-x86_64.tar.gz gpg: Signature made Thu 19 Nov 2015 10:04:45 PM JST using RSA key ID DE817B8E gpg: Good signature from "Joyent Package Signing <pkgsrc@joyent.com>" gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: 74C4 F303 BB45 7421 E42C 4DC4 FAE5 0048 FAA6 6EE0 Subkey fingerprint: 2163 0D8B 4486 4587 9655 3748 76FA BBBB DE81 7B8E
Good signature、でpkgsrc@joyent.comのサインなので、問題ありません。インストールします。
# tar xzpf bootstrap-trunk-x86_64.tar.gz -C /
NetBSDと同じ、/usr/pkg 以下にインストールされます。
あとは、PATHに追加すれば、自由に利用できます。
$ export PATH=/usr/pkg/sbin:/usr/pkg/bin:$PATH $ export MANPATH=/usr/pkg/man:$MANPATH
pkginコマンドあれこれ
SmartOSでは、pkgsrcはpkginコマンドでバイナリーパッケージをつかうもの、ということになっているようです。
Linuxでも同じようになっています。さっそくpkginコマンドをつかってみましょう。
最初にパッケージのデータベースをアップデートしないといけませんが、一番最初に、pkginコマンドを使うと、自動的にアップデートされるので気にすることはありません。(気になる人は、pkgin upして下さい。)
# pkgin ls reading local summary... processing local summary... processing remote summary (http://pkgsrc.joyent.com/packages/Linux/trunk/x86_64/All)... pkg_summary.xz 100% 1870KB 155.8KB/s 14.0KB/s 00:12 bmake-20150505 Portable (autoconf) version of NetBSD 'make' utility bootstrap-mk-files-20150908 *.mk files for the bootstrap bmake utility bzip2-1.0.6nb1 Block-sorting file compressor libarchive-3.1.2nb1 Library to read/create different archive formats mozilla-rootcerts-1.0.20150804 Root CA certificates from the Mozilla Project ncurses-6.0nb1 CRT screen handling and optimization package openssl-1.0.2d Secure Socket Layer and cryptographic library pkg_alternatives-1.6 Generic wrappers for programs with similar interfaces pkg_install-20150901 Package management and administration tools for pkgsrc pkgin-0.9.3nb1 Apt / yum like tool for managing pkgsrc binary packages pkgsrc-gnupg-keys-20150416 GnuPG keys for pkgsrc infrastructure readline-6.3nb3 GNU library that can recall and edit previous input sqlite3-3.9.2 SQL Database Engine in a C Library xz-5.2.2 XZ utilities zlib-1.2.8nb3 General purpose data compression library
インストールされているパッケージ一覧を表示します。(ls = list)
# pkgin av | head -10 0verkill-0.16nb1 0verkill is bloody 2D action deathmatch-like game in ASCII-ART 2bwm-20150526 Fast floating WM written over the XCB library and derived from mcwm 2vcard-0.5nb4 Convert an addressbook to the popular VCARD file format 3ddesktop-0.2.9nb13 3D Virtual Desktop Switcher 6tunnel-0.11rc2 Tunnelling for applications that don't speak IPv6 9e-1.0 Explode Plan9 archives 9menu-1.8nb1 Simple menu patterned after the plan9 user interface 9wm-1.1nb2 8 1/2-like Window Manager for X AnonymousPro-1.002 Fixed width Sans designed especially for Coders BasiliskII-1.0.20060501nb4 Open Source 68k Macintosh emulator
インストール可能なパッケージ一覧を表示します。(av = avaiable)
# pkgin in lv calculating dependencies... done. nothing to upgrade. 1 packages to be installed (375K to download, 506K to install): lv-4.51nb1 proceed ? [Y/n] downloading packages... lv-4.51nb1.tgz 100% 375KB 375.4KB/s 375.4KB/s 00:01 installing packages... installing lv-4.51nb1... pkg_install warnings: 0, errors: 0 reading local summary... processing local summary... marking lv-4.51nb1 as non auto-removable
パッケージをインストールします。(in = install)
# pkgin rm lv 1 packages to delete: lv-4.51nb1 proceed ? [Y/n] removing lv-4.51nb1... pkg_install warnings: 0, errors: 0 reading local summary... processing local summary...
パッケージをアンインストールします。(rm = remove)
# pkgin se nkf p5-nkf-2.13nb2 Perl library for Network Kanji code conversion Filter nkf-2.13nb2 Convert between various Japanese character encodings =: package is installed and up-to-date <: package is installed but newer version is available >: installed package has a greater version than available package
インストール可能なパッケージを検索します。(se = search)
使えるコマンド一覧は、引数なしで、pkginを実行して下さい。
# pkgin Usage: pkgin [-cdfFhlnPtvVy] command [package ...] Commands and shortcuts: list (ls ) - List installed packages. avail (av ) - List available packages. install (in ) - Perform packages installation or upgrade. update (up ) - Create and populate the initial database. remove (rm ) - Remove packages and depending packages. upgrade (ug ) - Upgrade main packages to their newer versions. full-upgrade (fug ) - Upgrade all packages to their newer versions. show-deps (sd ) - Display direct dependencies. show-full-deps (sfd ) - Display dependencies recursively. show-rev-deps (srd ) - Display reverse dependencies recursively. show-category (sc ) - Show packages belonging to category. show-pkg-category (spc ) - Show package's category. show-all-categories (sac ) - Show all categories. keep (ke ) - Mark package as "non auto-removable". unkeep (uk ) - Mark package as "auto-removable". show-keep (sk ) - Display "non auto-removable" packages. show-no-keep (snk ) - Display "auto-removable" packages. search (se ) - Search for a package. clean (cl ) - Clean packages cache. autoremove (ar ) - Autoremove orphan dependencies. export (ex ) - Export "non auto-removable" packages to stdout. import (im ) - Import "non auto-removable" package list from file. provides (prov) - Show what files a package provides. requires (req ) - Show what files a package requires. pkg-content (pc ) - Show remote package's content. pkg-descr (pd ) - Show remote package's long-description. pkg-build-defs (pbd ) - Show remote package's build definitions. stats (st ) - Packages statistics.
割愛しますが、manもあります。参考にして見て下さい。
例:新しいOpenSSHをインストールしてみよう
インストール
では、新しめのソフトがほしい、ということで、例として、OpenSSHをインストールしてみます。OpenSSHは、CentOS6の場合、5.3p1です。
では、pkginでインストールしてみましょう。sshで検索してみます。
# pkgin se ssh wbm-telnet-1.600nb1 Webmin module to login via telnet or SSH wbm-sshd-1.600nb1 Webmin module to setup the Secure Shell server sux-1.0nb1 Set user id, preserving shell and environment, checking ssh agent sslh-1.17nb1 Multiplex ssl, ssh, and other connections on the same port sshsh-1.0 Run a new shell with an SSH identity sshpass-1.05 Non-interactive ssh password auth sshguard-1.5nb1 Protect networked hosts from brute force attacks sshfp-1.1.3nb4 Print ssh host key fingerprint resource records ssh-ip-tunnel-1.0nb1 Simple VPN system using pppd over ssh ssh-askpass-1.0nb1 X11-based passphrase dialog for OpenSSH srsh-1.3 Emulate rsh client behavior using ssh secpanel-0.5.1nb1 GUI front-end for SSH scanssh-2.1nb14 SSH remote version scanner ruby22-sshkit-1.7.1 Makes it easy to write structured, testable SSH commands ruby22-net-ssh-multi-1.2.1 SSH connection multiplexing ruby22-net-ssh-gateway-1.2.0 Simple way to connect to servers behind a firewall or NAT ruby22-net-ssh-2.9.2 Secure shell for Ruby ruby21-sshkit-1.7.1 Makes it easy to write structured, testable SSH commands ruby21-net-ssh-multi-1.2.1 SSH connection multiplexing ruby21-net-ssh-gateway-1.2.0 Simple way to connect to servers behind a firewall or NAT ruby21-net-ssh-2.9.2 Secure shell for Ruby ruby200-sshkit-1.7.1 Makes it easy to write structured, testable SSH commands ruby200-net-ssh-multi-1.2.1 SSH connection multiplexing ruby200-net-ssh-gateway-1.2.0 Simple way to connect to servers behind a firewall or NAT ruby200-net-ssh-2.9.2 Secure shell for Ruby ruby193-sshkit-1.7.1 Makes it easy to write structured, testable SSH commands ruby193-net-ssh-multi-1.2.1 SSH connection multiplexing ruby193-net-ssh-gateway-1.2.0 Simple way to connect to servers behind a firewall or NAT ruby193-net-ssh-2.9.2 Secure shell for Ruby rssh-2.3.4nb1 Restricted shell allowing only scp and/or sftp qore-ssh2-module-0.9.9nb6 SSH2 module for Qore py34-paramiko-1.15.3 SSH2 protocol library py33-paramiko-1.15.3 SSH2 protocol library py27-paramiko-1.15.3 SSH2 protocol library py27-denyhosts-2.6nb5 Watch auth log for invalid ssh login attempts and block hosts php56-ssh2-0.12nb2 PHP bindings to the functions of libssh2 php55-ssh2-0.12nb2 PHP bindings to the functions of libssh2 php54-ssh2-0.12nb2 PHP bindings to the functions of libssh2 p5-SSH-Batch-0.029nb4 Cluster operations based on parallel SSH, set and interval arithmetic p5-Net-SSH-Expect-1.09nb1 Perl5 module implementing expect-like functions over SSH p5-Net-SSH-1.34nb7 Perl implementations of SSH1 and SSH2 protocols p5-Net-OpenSSH-0.57nb4 Perl SSH client package implemented on top of OpenSSH openssh-7.1.1nb1 Open Source Secure shell client and server (remote login program) netpgpverify-20151103 Standalone PGP and ssh signature verification utility libssh2-1.6.0 SSH2 protocol library libssh-0.72 SSHv2+v1 protocol library; libssh.org version 0.7.2 libssh-0.54nb3 SSHv2+v1 protocol library; libssh.org version 0.5.4 libnetpgpverify-20151103 PGP and ssh signature verification library kssh-0.7nb49 KDE Front-end to SSH keychain-2.7.1nb3 Nice ssh-agent front-end dsh-0.25.10nb1 Runs command through rsh or ssh on a cluster of machines dropbear-2013.62 Small SSH2 server and client, aimed at embedded market corkscrew-2.0 Tool for tunneling SSH through HTTP proxies ansible-1.6.10nb1 SSH-based configuration management, deployment, and task execution =: package is installed and up-to-date <: package is installed but newer version is available >: installed package has a greater version than available package
多すぎました。opensshで検索してみます。
# pkgin se openssh ssh-askpass-1.0nb1 X11-based passphrase dialog for OpenSSH p5-Net-OpenSSH-0.57nb4 Perl SSH client package implemented on top of OpenSSH openssh-7.1.1nb1 Open Source Secure shell client and server (remote login program) =: package is installed and up-to-date <: package is installed but newer version is available >: installed package has a greater version than available package
見つかりました。7.1がインストールできるようです。早速インストールしてみましょう。
# pkgin in openssh calculating dependencies... done. nothing to upgrade. 2 packages to be installed (1851K to download, 5737K to install): tcp_wrappers-7.6.4 openssh-7.1.1nb1 proceed ? [Y/n] downloading packages... tcp_wrappers-7.6.4.tgz 100% 88KB 88.5KB/s 88.5KB/s 00:01 openssh-7.1.1nb1.tgz 100% 1763KB 881.4KB/s 1.3MB/s 00:02 installing packages... installing tcp_wrappers-7.6.4... installing openssh-7.1.1nb1... openssh-7.1.1nb1: copying /usr/pkg/share/examples/openssh/moduli to /usr/pkg/etc/ssh/moduli openssh-7.1.1nb1: copying /usr/pkg/share/examples/openssh/ssh_config to /usr/pkg/etc/ssh/ssh_config openssh-7.1.1nb1: copying /usr/pkg/share/examples/openssh/sshd_config to /usr/pkg/etc/ssh/sshd_config =========================================================================== The following files should be created for openssh-7.1.1nb1: /etc/rc.d/sshd (m=0755) [/usr/pkg/share/examples/rc.d/sshd] =========================================================================== =========================================================================== *===* NOTICE *===* WARNING: previous configuration file /etc/ssh/sshd_config found. The config files for openssh-7.1.1nb1 must be located in: /usr/pkg/etc/ssh You will need to ensure your configuration files and/or keys are placed in the correct directory before using openssh-7.1.1nb1. =========================================================================== pkg_install warnings: 0, errors: 0 reading local summary... processing local summary... marking openssh-7.1.1nb1 as non auto-removable
インストールできました。注意書きにあるとおり、NetBSDと同じく、/usr/pkg/etc 以下が設定ファイルです。
# ssh -V OpenSSH_7.1p1, OpenSSL 1.0.2d 9 Jul 2015
おぉ、7.1p1です。
# pkgin ls bmake-20150505 Portable (autoconf) version of NetBSD 'make' utility bootstrap-mk-files-20150908 *.mk files for the bootstrap bmake utility bzip2-1.0.6nb1 Block-sorting file compressor libarchive-3.1.2nb1 Library to read/create different archive formats mozilla-rootcerts-1.0.20150804 Root CA certificates from the Mozilla Project ncurses-6.0nb1 CRT screen handling and optimization package openssh-7.1.1nb1 Open Source Secure shell client and server (remote login program) openssl-1.0.2d Secure Socket Layer and cryptographic library pkg_alternatives-1.6 Generic wrappers for programs with similar interfaces pkg_install-20150901 Package management and administration tools for pkgsrc pkgin-0.9.3nb1 Apt / yum like tool for managing pkgsrc binary packages pkgsrc-gnupg-keys-20150416 GnuPG keys for pkgsrc infrastructure readline-6.3nb3 GNU library that can recall and edit previous input sqlite3-3.9.2 SQL Database Engine in a C Library tcp_wrappers-7.6.4 Monitor and filter incoming requests for network services xz-5.2.2 XZ utilities zlib-1.2.8nb3 General purpose data compression library
たしかに、さっきより、いくつかインストールされたパッケージが増えましたね。
自動起動できるようにしたい
これで、sshコマンドとかは、7.1が使えるようになりました。しかし、sshdもそうしたいですよね。
/etc/rc.local に何か書く、という手もありますが、いまいちイケていません。そこでこうします。
まず、rc.subr と rcorder パッケージを導入します。
# pkgin in rc.subr rcorder calculating dependencies... done. nothing to upgrade. 2 packages to be installed (12K to download, 45K to install): rc.subr-20150510 rcorder-20120310 proceed ? [Y/n] downloading packages... rc.subr-20150510.tgz 100% 15KB 15.0KB/s 15.0KB/s 00:00 rcorder-20120310.tgz 100% 12KB 11.9KB/s 11.9KB/s 00:00 installing packages... installing rc.subr-20150510... rc.subr-20150510: copying //etc/rc.conf.example to //etc/rc.conf installing rcorder-20120310... pkg_install warnings: 0, errors: 0 reading local summary... processing local summary... marking rc.subr-20150510 as non auto-removable marking rcorder-20120310 as non auto-removable
これをインストールすると、NetBSDのrc.d起動機構に関係するファイルがインストールされます。
# pkg_info -L rcorder Information for rcorder-20120310: Files: /usr/pkg/sbin/rcorder /usr/pkg/man/man8/rcorder.8
# pkg_info -L rc.subr Information for rc.subr-20150510: Files: /etc/rc.conf.example /etc/rc.subr /etc/rc.d/DAEMON /etc/rc.d/LOGIN /etc/rc.d/NETWORKING /etc/rc.d/SERVERS
こんな感じ。
/etc/rc.d はCentOS側で使っているディレクトリなので、ちょっと困ります。そこで、以下のような細工をします。
# mkdir /usr/pkg/etc/rc.d # cd /usr/pkg/etc/rc.d # ln -s /etc/rc.d/DAEMON . # ln -s /etc/rc.d/LOGIN . # ln -s /etc/rc.d/NETWORKING . # ln -s /etc/rc.d/SERVERS .
あと、以下のようなファイルを /usr/pkg/etc/rc.d/mountcritremote につくって、chmod 755しておいて下さい。
#!/bin/sh # # mountcritremote # # PROVIDE: mountcritremote # REQUIRE: NETWORKING # This is a dummy.
次に、このrc.d起動機構にあるファイルを起動するよう、CentOS側をなんとかします。 以下の内容のファイルを/etc/init.d/rcdに作成します。[3]
#!/bin/sh # # Run pkgsrc scripts in /usr/pkg/etc/rc.d with rcorder. # # This file imported from DracoLinux (http://www.dracolinux.org/). # # chkconfig: - 95 20 # description: NetBSD rc.d startup scripts . /etc/rc.subr . /etc/rc.conf _rc_conf_loaded=true scripts=$(for rcd in /usr/pkg/etc/rc.d/*; do echo ${rcd} ;done) RETVAL=0 prog="rcd" servicename=$prog start() { echo "Starting pkgsrc services: " files=$(/usr/pkg/sbin/rcorder -s nostart ${rc_rcorder_flags} ${scripts}) for _rc_elem in $files; do run_rc_script $_rc_elem start 2> /dev/null done } stop() { echo "Stopping pkgsrc services: " files=$(/usr/pkg/sbin/rcorder ${rc_rcorder_flags} ${scripts}|tac) for _rc_elem in $files; do run_rc_script $_rc_elem stop 2> /dev/null done } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo "Usage: $prog {start|stop|restart}" exit 1 ;; esac exit $RETVAL
これを自動起動するようにします。
# chmod 755 /etc/init.d/rcd # chkconfig --add rcd # chkconfig rcd on
これで、NetBSDと同じような感じで、/usr/pkg/etc/rc.d の下に、起動ファイルを置けば、自動的に起動されるようになります。
# cp /etc/rc.conf.example /etc/rc.conf # echo 'sshd=YES' >> /etc/rc.conf # cp -a /usr/pkg/share/example/rc.d/sshd /usr/pkg/etc/rc.d
既存のhost keysをコピーします。
# cd /usr/pkg/etc/ssh # cp -a /etc/ssh/ssh*key* .
試しに、起動するか試してみましょう。/usr/pkg/etc/ssh/sshd_config を編集して、8022番ポートで待ち受けるようにします。(あと、pidファイル名を変えて下さい。rpmの方のsshdのと重複します。)
# service rcd start Starting pkgsrc services: You already have a DSA host key in /usr/pkg/etc/ssh/ssh_host_dsa_key Skipping protocol version 2 DSA Key Generation You already have a RSA host key in /usr/pkg/etc/ssh/ssh_host_rsa_key Skipping protocol version 2 RSA Key Generation Generating public/private ecdsa key pair. Your identification has been saved in /usr/pkg/etc/ssh/ssh_host_ecdsa_key. Your public key has been saved in /usr/pkg/etc/ssh/ssh_host_ecdsa_key.pub. The key fingerprint is: SHA256:xFipL7cEHLsANcLNux3dNsAYsbO1/dcO9vy3GhlxLEE root@vxxx-x-xx-xx.xxxxx.static.cnode.jp The key's randomart image is: +---[ECDSA 256]---+ | ..+o o=.. .E | | o.o.o=+ o | | . o+=+o o o | | o *=.o+ + | | +.=S... . | | . + + . o. | | + . .o+ .| | . o.=.| | ...O| +----[SHA256]-----+ Generating public/private ed25519 key pair. Your identification has been saved in /usr/pkg/etc/ssh/ssh_host_ed25519_key. Your public key has been saved in /usr/pkg/etc/ssh/ssh_host_ed25519_key.pub. The key fingerprint is: SHA256:oXUO8G8rRIC8qDBtFGGNKwZyw81b0wjTVnNdoM4wSXs root@vxxx-x-xx-xx.xxxxx.static.cnode.jp The key's randomart image is: +--[ED25519 256]--+ | .+Oo+o++ ...o. | |o.* *.*=.= .. | |o+ + = .@ E | |+.= o + % | |o= . S * | |. . . . | | . . | | . | | | +----[SHA256]-----+ Starting sshd. # netstat -an | grep :8022 tcp 0 0 0.0.0.0:8022 0.0.0.0:* LISTEN tcp 0 0 :::8022 :::* LISTEN
おぉ、8022番ポートをListenしています。sshしてみましょう。
# ssh -p 8022 -v localhost OpenSSH_7.1p1, OpenSSL 1.0.2d 9 Jul 2015 debug1: Reading configuration data /usr/pkg/etc/ssh/ssh_config debug1: Connecting to localhost [::1] port 8022. debug1: Connection established. debug1: permanently_set_uid: 0/0 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_rsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_rsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_dsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_dsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_ecdsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_ecdsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_ed25519 type -1 debug1: key_load_public: No such file or directory debug1: identity file /root/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_7.1 debug1: Remote protocol version 2.0, remote software version OpenSSH_7.1 debug1: match: OpenSSH_7.1 pat OpenSSH* compat 0x04000000 debug1: Authenticating to localhost:8022 as 'root' debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client chacha20-poly1305@openssh.com <implicit> none debug1: kex: client->server chacha20-poly1305@openssh.com <implicit> none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ecdsa-sha2-nistp256 SHA256:xFipL7cEHLsANcLNux3dNsAYsbO1/dcO9vy3GhlxLEE debug1: checking without port identifier The authenticity of host '[localhost]:8022 ([::1]:8022)' can't be established. ECDSA key fingerprint is SHA256:xFipL7cEHLsANcLNux3dNsAYsbO1/dcO9vy3GhlxLEE. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '[localhost]:8022' (ECDSA) to the list of known hosts. debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: Roaming not allowed by server debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,password,keyboard-interactive debug1: Next authentication method: publickey debug1: Trying private key: /root/.ssh/id_rsa debug1: Trying private key: /root/.ssh/id_dsa debug1: Trying private key: /root/.ssh/id_ecdsa debug1: Trying private key: /root/.ssh/id_ed25519 debug1: Next authentication method: keyboard-interactive debug1: Authentications that can continue: publickey,password,keyboard-interactive debug1: Next authentication method: password root@localhost's password:
「remote software version OpenSSH_7.1」になっていますし、ECDSA keyが使われたり、間違いありません。
/usr/pkg/etc/ssh/sshd_configを再度編集し、8022番ポートの待受設定を元に戻します。
あとは、CentOS側のsshdを止め、pkgsrc側のsshdを上がるようにすればOKです。再起動して上がってくるか試してみます。
# chkconfig sshd off # sync;shutdown -r now
リモートから、sshでログインできるか試してみて下さい。
あとがき
NetBSD使っているひとって、みんな古くから使っていて初心者なんかいなさそうで(そんなことはない)、英語なんかもすらすら読めて(ぼくはちがう)、デバイスドライバ書いたりカーネルいじったりしていて(ぼくは超ちがう)、っていうすごいはっかー、ていう感じがします。
そんなことは全然全くさっぱりちっともないただの利用者たるぼくですが、何か書いてみることにしました。誰かのお役に立てれば幸いです。
もし、バイナリーパッケージじゃなくて、bootstrapから自分でやってみたい、という人は、以前書いた、"ServersMan@VPSのCentOSでpkgsrc"が参考になるかもしれません。よかったら、どうぞ。
ではでは。
明日のAdvent Calendarは
ryoonさんの『NetBSD/amd64 current on Toshiba dynabook R63/PS』です。楽しみです。
間違いの指摘や、ご意見などは、FrontPageにある連絡先にメールを下さるとうれしいです。
最終更新時間:2015年12月16日 21時47分55秒