スイッチングハブとかにあるコンソールポートに接続する場合、WindowsならTera Termを使うことが多いのですが、今回はUbuntuでということでckermit
を使って接続してみました。
Ubuntuのバージョンは12で、使用したUSB-シリアルケーブルはUSB-RSAQ2です。
apt
コマンド を使って ckermit
をインストールします。
$ sudo apt install ckermit
.kermrc に設定を流し込みます。
cat <<__EOF__ > ~/.kermrc
set line /dev/ttyUSB0
set speed 9600
set stop-bits 1
set flow-control none
set parity none
set carrier-watch off
__EOF__
起動します。
$ kermit
?OpenSSL libraries do not match required version:
. C-Kermit built with OpenSSL 1.0.0e 6 Sep 2011
. Version found OpenSSL 1.0.1 14 Mar 2012
OpenSSL versions prior to 1.0.0 must be the same.
Set LD_LIBRARY_PATH for OpenSSL 1.0.0e 6 Sep 2011.
Or rebuild C-Kermit from source on this computer to make versions agree.
C-Kermit makefile target: linux+krb5+openssl
Or if that is what you did then try to find out why
the program loader (image activator) is choosing a
different OpenSSL library than the one specified in the build.
All SSL/TLS features disabled.
/dev/ttyUSB0: Permission denied
?SET SPEED has no effect without prior SET LINE
C-Kermit 9.0.302 OPEN SOURCE:, 20 Aug 2011, for Linux+SSL+KRB5
Copyright (C) 1985, 2011,
Trustees of Columbia University in the City of New York.
Type ? or HELP for help.
(/) C-Kermit>c
Sorry, you must SET LINE or SET HOST first
OpenSSLのバージョンが一致しないとか怒られたあげく、 接続コマンド「c」を入力し[Enter]してもSorry,となって接続できません。
よく見てみると /dev/ttyUSB0: Permission denied と権限がないようなエラーが出ています。ls
コマンドで確認してみると確かに root と dialout グループしか書き込む権限がないことが分かります。
$ ls -Al /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 0 7月 3 16:21 /dev/ttyUSB0
udev のルールを書く必要がありそうですので、まずは lsusb
で接続した機器のIDを調べます。
$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 04da:2505 Panasonic (Matsushita)
Bus 004 Device 002: ID 413c:3010 Dell Computer Corp. Optical Wheel Mouse
Bus 004 Device 005: ID 067b:04bb Prolific Technology, Inc. PL2303 Serial (IODATA USB-RSAQ2)
最後の行が今回接続した USB-RSAQ2 のようですので、そのIDである「067b:04bb」をもとにルールを書きます。書き方は色々とあると思うんですが、今回はとりあえずどのユーザでも使えるようにパーミッションを「rw-rw-rw」にしてみます。
echo 'SUBSYSTEM=="tty", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="04bb", MODE="0666"' | sudo tee /etc/udev/rules.d/50-usb-serial.rules
ルールを読み込ませます。
$ sudo udevadm control --reload-rules
一度USB-シリアルケーブルを取り外して再度接続してみます。先ほどと同じようにls
コマンドで確認してみると今度は /dev/ttyUSB0 のパーミッションが「rw-rw-rw-」となって誰でも書き込みができるようになっている事が確認できました。
$ ls -Al /dev/ttyUSB0
crw-rw-rw- 1 root dialout 188, 0 7月 3 16:54 /dev/ttyUSB0
パーミッションが確認できたので再び接続します。 Permission denied が出ていない事を確認し「c」、[Enter]で接続してみます。
$ kermit
?OpenSSL libraries do not match required version:
. C-Kermit built with OpenSSL 1.0.0e 6 Sep 2011
. Version found OpenSSL 1.0.1 14 Mar 2012
OpenSSL versions prior to 1.0.0 must be the same.
Set LD_LIBRARY_PATH for OpenSSL 1.0.0e 6 Sep 2011.
Or rebuild C-Kermit from source on this computer to make versions agree.
C-Kermit makefile target: linux+krb5+openssl
Or if that is what you did then try to find out why
the program loader (image activator) is choosing a
different OpenSSL library than the one specified in the build.
All SSL/TLS features disabled.
C-Kermit 9.0.302 OPEN SOURCE:, 20 Aug 2011, for Linux+SSL+KRB5
Copyright (C) 1985, 2011,
Trustees of Columbia University in the City of New York.
Type ? or HELP for help.
(/) C-Kermit>c
Connecting to /dev/ttyUSB0, speed 9600
Escape character: Ctrl-\ (ASCII 28, FS): enabled
Type the escape character followed by C to get back,
or followed by ? to see other options.
----------------------------------------------------
hello>
接続できました。
接続を閉じる場合は接続時のメッセージの中に書いてあるとおり、 [CTRL] キーを押しながら [¥] キーを押し、 [c] キーを押します。