telnet できるようにする

Debian TS-WXL

一つ一つ解決していくために、 telnet して中に入れるようにする

HDD2 の標準ファームから起動

実験用 HDD を HDD1 に刺す

root でログイン

BUFFALO INC. TeraStation series
TS-WXL3B3 login: root
Last login: Sun Mar  7 23:13:16 +0900 2010 on ttyS0.
No mail.
root@TS-WXL3B3:~#

ディスクの再認識

root@TS-WXL3B3:~# cd /usr/local/bin
root@TS-WXL3B3:/usr/local/bin# ./hdd_wakeup.sh  disk1
	:

マウント

root@TS-WXL3B3:/usr/local/bin# cd
root@TS-WXL3B3:~# mkdir /tmp/root
root@TS-WXL3B3:~# mount -t ext3 /dev/sdb2 /tmp/root
kjournald starting.  Commit interval 5 seconds
EXT3-fs warning: maximal mount count reached, running e2fsck is recommended
EXT3 FS on sdb2, internal journal
EXT3-fs: recovery complete.
EXT3-fs: mounted filesystem with ordered data mode.
root@TS-WXL3B3:~#

/initrd の確認

ちゃんと作ったのに、なぜエラーになる?
root@TS-WXL3B3:/tmp/root# ls
bin      etc      linuxrc  opt      sbin     sys      var
boot     home     media    proc     selinux  tmp
dev      lib      mnt      root     srv      usr
root@TS-WXL3B3:/tmp/root#
がはっ。linuxrc 作ってる。
やり直し。
root@TS-WXL3B3:/tmp/root# rmdir linuxrc
root@TS-WXL3B3:/tmp/root# mkdir initrd
root@TS-WXL3B3:/tmp/root#

chroot する

root@TS-WXL3B3:/tmp/root# chroot .
sh-3.2# ls
bin   dev  home    lib    mnt  proc  sbin     srv  tmp  var
boot  etc  initrd  media  opt  root  selinux  sys  usr
sh-3.2#

telnetd をインストールする

必要なパッケージは、、、
sh-3.2# apt-cache search telnet
	:
	:
inetutils-telnetd - telnet server
	:
	:
inetutils-telnetd をインストールする。
sh-3.2# apt-get install inetutils-telnetd
Reading package lists... Done
Building dependency tree... Done
The following extra packages will be installed:
  inetutils-inetd libidn11 libshishi0 shishi-common
Suggested packages:
  shishi
The following NEW packages will be installed:
  inetutils-inetd inetutils-telnetd libidn11 libshishi0 shishi-common
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 673kB of archives.
After this operation, 1544kB of additional disk space will be used.
Do you want to continue [Y/n]? y
WARNING: The following packages cannot be authenticated!
  libidn11 inetutils-inetd shishi-common libshishi0 inetutils-telnetd
Install these packages without verification [y/N]? y
Get:1 http://ftp.jp.debian.org lenny/main libidn11 1.8+20080606-1 [140kB]
Get:2 http://ftp.jp.debian.org lenny/main inetutils-inetd 2:1.5.dfsg.1-9 [81.9kB]
Get:3 http://ftp.jp.debian.org lenny/main shishi-common 0.0.37-1 [126kB]
Get:4 http://ftp.jp.debian.org lenny/main libshishi0 0.0.37-1 [222kB]
Get:5 http://ftp.jp.debian.org lenny/main inetutils-telnetd 2:1.5.dfsg.1-9 [104kB]
Fetched 673kB in 1s (667kB/s)
Selecting previously deselected package libidn11.
(Reading database ... 7899 files and directories currently installed.)
Unpacking libidn11 (from .../libidn11_1.8+20080606-1_armel.deb) ...
Selecting previously deselected package inetutils-inetd.
Unpacking inetutils-inetd (from .../inetutils-inetd_2%3a1.5.dfsg.1-9_armel.deb) ...
Selecting previously deselected package shishi-common.
Unpacking shishi-common (from .../shishi-common_0.0.37-1_all.deb) ...
Selecting previously deselected package libshishi0.
Unpacking libshishi0 (from .../libshishi0_0.0.37-1_armel.deb) ...
Selecting previously deselected package inetutils-telnetd.
Unpacking inetutils-telnetd (from .../inetutils-telnetd_2%3a1.5.dfsg.1-9_armel.deb) ...
Processing triggers for man-db ...
Setting up libidn11 (1.8+20080606-1) ...
Setting up inetutils-inetd (2:1.5.dfsg.1-9) ...
Not starting internet superserver: no services enabled. (warning).
Setting up shishi-common (0.0.37-1) ...
Setting up libshishi0 (0.0.37-1) ...
Setting up inetutils-telnetd (2:1.5.dfsg.1-9) ...
invoke-rc.d: initscript inetutils-inetd, action "force-reload" failed.
sh-3.2#
エラーがでている。
sh-3.2# grep telnet /etc/inetd.conf
## telnet  stream  tcp     nowait  root    /usr/sbin/telnetd       telnetd
sh-3.2#
無効になっている。どうやって有効にするのが正しい?

とりあえず、sed で編集する

sh-3.2# cd etc/
sh-3.2# mv inetd.conf inetd.conf.orig
sh-3.2# sed -e 's/^## telnet/telnet/' inetd.conf.orig > inetd.conf
sh-3.2# diff -c inetd.conf.orig inetd.conf
*** inetd.conf.orig     Tue Mar 16 23:13:12 2010
--- inetd.conf  Tue Mar 16 23:16:04 2010
***************
*** 20,26 ****
  #time         stream  tcp     nowait  root    internal

  #:STANDARD: These are standard services.
! ## telnet        stream  tcp     nowait  root    /usr/sbin/telnetd       telnetd

  #:BSD: Shell, login, exec and talk are BSD protocols.

--- 20,26 ----
  #time         stream  tcp     nowait  root    internal

  #:STANDARD: These are standard services.
! telnet        stream  tcp     nowait  root    /usr/sbin/telnetd       telnetd

  #:BSD: Shell, login, exec and talk are BSD protocols.

sh-3.2# ls -l inetd.conf*
-rw-r--r-- 1 root root 1112 Mar 16 23:16 inetd.conf
-rw-r--r-- 1 root root 1120 Mar 16 23:13 inetd.conf.orig
sh-3.2#

一般ユーザの作成

root ではログインできないので、一般ユーザを作っておく。
sh-3.2# addgroup --gid 1001 yamasita
Adding group `yamasita' (GID 1001) ...
Done.
sh-3.2# mkdir /home/yamasita
sh-3.2# adduser --home /home/yamasita/yasunari --ingroup yamasita yasunari
Adding user `yasunari' ...
Adding new user `yasunari' (1000) with group `yamasita' ...
Creating home directory `/home/yamasita/yasunari' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for yasunari
Enter the new value, or press ENTER for the default
        Full Name []: Yasunari Yamashita
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [Y/n] y
sh-3.2#
こんなところか。。。

chroot を抜ける

sh-3.2# exit
exit
root@TS-WXL3B3:/tmp/root#

アンマウント

root@TS-WXL3B3:/tmp/root# cd /
root@TS-WXL3B3:/# umount /tmp/root
root@TS-WXL3B3:/#

再起動

電源ボタン長押しで電源OFF、
HDD2 を抜いて
電源ボタンを押す

linuxrc は変えていないので、、、

	:
	:
---- in hackkit linuxrc ---
err: RecvPacket: readlen=0.
これは同じ
	:
	:
Trying to move old root to /initrd ... okay
これはOKになった。

telnet する


Linux 2.6.22.18-mv78100 (x31l.yamasita.jp) (pts/0)

tswxl login: yasunari
Password:
Linux tswxl 2.6.22.18-mv78100 #134 Thu Feb 4 11:14:40 JST 2010 armv5tejl

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.
yasunari@tswxl:~$
だーん

と思ったら、、、

root になれない

yasunari@tswxl:~$ su - root
Password: Enter だけ
su: Authentication failure
yasunari@tswxl:~$ su - root
Password: 思い当たるパスワード
su: Authentication failure
yasunari@tswxl:~$
何で?パスワード付けた覚えないのに。

TS-WXL
楽天市場
amazon
Yahoo ショッピング
Livedoor デパート


debian 化の課題
ハックの記録
LinkStation/玄箱 をハックしよう

root にパスワードを付ける

Copyright (C) 2003-2010 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市