主にUNIXコンピュータで利用される、ネットワークを介して別のコンピュータにログインして操作するためのソフトウェアの一つ。通信経路が暗号化されるため、インターネットなどを経由しても安全にアクセスすることができる。
コンピュータ上で動作しているOSに利用者が指示を与えるためのシェル(shell)と呼ばれるプログラムの一種で、遠隔からコンピュータの操作画面を呼び出し、手元のコンピュータのキーボードなどで入力したコマンド(命令)などを送信して実行し、結果を受信して表示することができる。公開鍵暗号と秘密鍵暗号を組み合わせて通信経路を暗号化し、パスワードなどの認証情報や入力されるコマンド、出力された処理結果などをすべて暗号化して送受信する。
ということで接続するためのソフトをダウンロードしましょう。
TeraTerm
初期状態では「root」(ルート権限を持ったスーパーユーザー)のみ存在しています。
「root」は非常に強力な権限を持っているため、通常の作業には向きません。
通常作業は、操作内容が限られたユーザーを追加して、作業を行いましょう。
# adduser UserName UserNameには作りたいユーザー名を入れてください
# passwd UserName
パスワード入力 二回
# passwd UserName
パスワード入力 二回
一般ユーザーだと色々実行できないことがあり不便なので、スーパーユーザー権限で実行できるように権限をあたえます。
一番下に追加します。
ユーザ名 ホスト=(権限) コマンド という書式になっています。
#visudo
一番下に追加します。
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL) ALL
# Uncomment to allow members of group sudo to not need a password
# (Note that later entries override this, so you might need to move
# it further down)
# %sudo ALL=NOPASSWD: ALL
UserName ALL=(ALL)ALL
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL) ALL
# Uncomment to allow members of group sudo to not need a password
# (Note that later entries override this, so you might need to move
# it further down)
# %sudo ALL=NOPASSWD: ALL
UserName ALL=(ALL)ALL
入力が終わったら :wq で上書きします。
rootでのログインを禁止する
# vi /etc/ssh/sshd_config
下記の部分に緑色の部分を追加してください
#PermitRootLogin yes
PermitRootLogin no
PermitRootLogin no
SSHDを再起動します。
# systemctl restart sshd