綾小路龍之介の素人思考

[debian] リモートでアップグレードする準備、sshの導入。

リモートでlennyからsqueezeへのアップグレードを行う。リリースノートではその際にrshを使うことは禁止されているので、sshをインストールしておく。

アップグレードしたいシステムで以下のコマンドを入力。

# aptitude install ssh
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Reading task descriptions... Done
The following NEW packages will be installed:
  libx11-6{a} libx11-data{a} libxau6{a} libxcb-xlib0{a} libxcb1{a} libxdmcp6{a} libxext6{a} libxmuu1{a} openssh-blacklist{a} openssh-blacklist-extra{a}
  openssh-client{a} openssh-server{a} ssh x11-common{a} xauth{a}
0 packages upgraded, 15 newly installed, 0 to remove and 0 not upgraded.
Need to get 6770kB of archives. After unpacking 17.3MB will be used.
Do you want to continue? [Y/n/?] y
Writing extended state information... Done
Get:1 http://ftp.jp.debian.org lenny/main openssh-blacklist 0.4.1 [2125kB]
Get:2 http://ftp.jp.debian.org lenny/main openssh-blacklist-extra 0.4.1 [2127kB]
Get:3 http://ftp.jp.debian.org lenny/main x11-common 1:7.3+20 [343kB]
Get:4 http://ftp.jp.debian.org lenny/main libxau6 1:1.0.3-3 [12.5kB]
Get:5 http://ftp.jp.debian.org lenny/main libxdmcp6 1:1.0.2-3 [17.9kB]
Get:6 http://ftp.jp.debian.org lenny/main libxcb1 1.1-1.2 [47.5kB]
Get:7 http://ftp.jp.debian.org lenny/main libxcb-xlib0 1.1-1.2 [15.4kB]
Get:8 http://ftp.jp.debian.org lenny/main libx11-data 2:1.1.5-2 [169kB]
Get:9 http://ftp.jp.debian.org lenny/main libx11-6 2:1.1.5-2 [660kB]
Get:10 http://ftp.jp.debian.org lenny/main libxext6 2:1.0.4-2 [37.3kB]
Get:11 http://ftp.jp.debian.org lenny/main libxmuu1 2:1.0.4-1 [13.7kB]
Get:12 http://ftp.jp.debian.org lenny/main xauth 1:1.0.3-2 [32.9kB]
Get:13 http://ftp.jp.debian.org lenny/main openssh-client 1:5.1p1-5 [854kB]
Get:14 http://ftp.jp.debian.org lenny/main openssh-server 1:5.1p1-5 [313kB]
Get:15 http://ftp.jp.debian.org lenny/main ssh 1:5.1p1-5 [1202B]
Fetched 6770kB in 4s (1368kB/s)
Preconfiguring packages ...
Selecting previously deselected package openssh-blacklist.
(Reading database ... 16361 files and directories currently installed.)
Unpacking openssh-blacklist (from .../openssh-blacklist_0.4.1_all.deb) ...
Selecting previously deselected package openssh-blacklist-extra.
Unpacking openssh-blacklist-extra (from .../openssh-blacklist-extra_0.4.1_all.deb) ...
Selecting previously deselected package x11-common.
Unpacking x11-common (from .../x11-common_1%3a7.3+20_all.deb) ...
Selecting previously deselected package libxau6.
Unpacking libxau6 (from .../libxau6_1%3a1.0.3-3_amd64.deb) ...
Selecting previously deselected package libxdmcp6.
Unpacking libxdmcp6 (from .../libxdmcp6_1%3a1.0.2-3_amd64.deb) ...
Selecting previously deselected package libxcb1.
Unpacking libxcb1 (from .../libxcb1_1.1-1.2_amd64.deb) ...
Selecting previously deselected package libxcb-xlib0.
Unpacking libxcb-xlib0 (from .../libxcb-xlib0_1.1-1.2_amd64.deb) ...
Selecting previously deselected package libx11-data.
Unpacking libx11-data (from .../libx11-data_2%3a1.1.5-2_all.deb) ...
Selecting previously deselected package libx11-6.
Unpacking libx11-6 (from .../libx11-6_2%3a1.1.5-2_amd64.deb) ...
Selecting previously deselected package libxext6.
Unpacking libxext6 (from .../libxext6_2%3a1.0.4-2_amd64.deb) ...
Selecting previously deselected package libxmuu1.
Unpacking libxmuu1 (from .../libxmuu1_2%3a1.0.4-1_amd64.deb) ...
Processing triggers for man-db ...
Setting up x11-common (1:7.3+20) ...
Selecting previously deselected package xauth.
(Reading database ... 16693 files and directories currently installed.)
Unpacking xauth (from .../xauth_1%3a1.0.3-2_amd64.deb) ...
Selecting previously deselected package openssh-client.
Unpacking openssh-client (from .../openssh-client_1%3a5.1p1-5_amd64.deb) ...
Selecting previously deselected package openssh-server.
Unpacking openssh-server (from .../openssh-server_1%3a5.1p1-5_amd64.deb) ...
Selecting previously deselected package ssh.
Unpacking ssh (from .../ssh_1%3a5.1p1-5_all.deb) ...
Processing triggers for man-db ...
Setting up openssh-blacklist (0.4.1) ...
Setting up openssh-blacklist-extra (0.4.1) ...
Setting up libxau6 (1:1.0.3-3) ...
Setting up libxdmcp6 (1:1.0.2-3) ...
Setting up libxcb1 (1.1-1.2) ...
Setting up libxcb-xlib0 (1.1-1.2) ...
Setting up libx11-data (2:1.1.5-2) ...
Setting up libx11-6 (2:1.1.5-2) ...
Setting up libxext6 (2:1.0.4-2) ...
Setting up libxmuu1 (2:1.0.4-1) ...
Setting up xauth (1:1.0.3-2) ...
Setting up openssh-client (1:5.1p1-5) ...
Setting up openssh-server (1:5.1p1-5) ...
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Restarting OpenBSD Secure Shell server: sshd.
Setting up ssh (1:5.1p1-5) ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done
Reading task descriptions... Done

あとはクライアントからログイン。以降はsshで作業する。

$ ssh -l ** ******
The authenticity of host '****** (************)' can't be established.
RSA key fingerprint is ***********************************************.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '******,************' (RSA) to the list of known hosts.
**@******'s password:
Linux ****** 2.6.26-2-amd64 #1 SMP Tue Jan 25 05:59:43 UTC 2011 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Feb 17 23:31:03 2011 from ************
**@******:~$

rootでもsshでログインできてしまうことに注意。アップデート以降使わないのならsshを削除してしまうほうがいいかもしれない。

$ ssh -l root ha8000
root@******'s password:
Permission denied, please try again.
root@******'s password:
Linux ****** 2.6.32-5-amd64 #1 SMP Wed Jan 12 03:40:32 UTC 2011 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun Dec  5 15:22:57 2010
******:~#

lennyからsqueezeへアップデートが完了したことを確認したい場合は/etc/debian_versionを参照すればよい。以下のように6.0となっていればアップデート完了している。

# cat /etc/debian_version
6.0

ログアウトして、rshで一般ユーザログイン。rootに替わる。

******:~# exit
logout
Connection to ****** closed.
$ rsh -l ** ******
Password:
Last login: Fri Feb 18 20:44:11 JST 2011 from ************ on pts/0
Linux ****** 2.6.32-5-amd64 #1 SMP Wed Jan 12 03:40:32 UTC 2011 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
**@******:~$ su -
Password:

sshを削除する。このとき本体だけでなく設定ファイルも削除するためにaptitude purgeを使う。

******:~# aptitude purge ssh
The following packages will be REMOVED:
  openssh-blacklist{u} openssh-blacklist-extra{u} openssh-client{u} openssh-server{u} ssh{p}
0 packages upgraded, 0 newly installed, 5 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 11.5 MB will be freed.
Do you want to continue? [Y/n/?] Y
(Reading database ... 35785 files and directories currently installed.)
Removing ssh ...
(Reading database ... 35783 files and directories currently installed.)
Removing openssh-server ...
Stopping OpenBSD Secure Shell server: sshd.
Removing openssh-blacklist ...
Removing openssh-blacklist-extra ...
Removing openssh-client ...
Processing triggers for man-db ...

リファレンス

  1. 第4章 Debian 5.0 (lenny) からのアップグレード
  2. aptitudeコマンド(パッケージの管理)
  3. aptitude 削除 - Google 検索
  4. aptitude install ssh - Google 検索
  5. Debianインストール覚え書き

ソーシャルブックマーク

  1. はてなブックマーク
  2. Google Bookmarks
  3. del.icio.us

ChangeLog

  1. Posted: 2009-09-30T20:38:26+09:00
  2. Modified: 2009-09-30T20:38:26+09:00
  3. Generated: 2017-09-07T23:09:20+09:00