Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/dennieser/dennie.tokyo/public_html/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340
SSHの設定サーバ編 – web.lab

SSHの設定サーバ編

LinuxサーバへSSH接続できるように数回にわたり記載します。
今回はLinuxサーバで行う設定を記載します。

環境はこちらを確認して下さい。
自分の為の備忘録である故、雑な記載となっています。


sshとは??

telnetやsshは通信プロトコルです。
2000年代前半まではリモート接続にはtelnetを使用していましたが、いつの間にかSSHで接続するようになりました。
理由としてはtelnetは通信の内容が丸裸なのでセキュリティ上良くないです。
そこで、通信内容を暗号化してリモートホストと通信出来るSSHが利用されることになりました。
sshは公開鍵認証により通信が暗号されます。


sshの設定

以下により、SSHを設定します。


SSHのインストール確認

今回はssh接続にopenSSHを使用する為、以下のコマンドでopenSSHが存在するか確認します。

yum list installed | grep ssh

以下が存在することを確認して下さい。
openssh-server.x86_64

存在しない場合、インストールして下さい。

yum -y install openssh-server


SSHの設定

sshの設定ファイル(sshd_config)にて設定を行います。

cd /etc/ssh/sshd_config
vi ssh_config

■注意
設定ファイルはバックアップをとるようにしましょう。(権限がない場合先頭にsudoで実行して下さい。)
cp ssh_config sshd_config_bk
(sudo cp ssh_config sshd_config_bk)

設定内容は以下です。

項目 内容
Port SSHを使用するポート番号を設定します。22が一般的なので22を設定します。
PermitRootLogin rootユーザでのログインを許可するかを指定します。セキュリティ上rootユーザでのログインは避けましょう。ゆえに”no”を指定します。
PasswordAuthentication パスワード認証するかを設定します。今回は鍵方式で認証するのでnoを設定します。
PermitEmptyPasswords 空のパスワードを許可するかを設定します。セキュリティ上良くないので”no”を設定します。


SSHサービスの起動

SSHのサービスが起動しているかを確認します。

systemctl status sshd.service

サービスの起動は以下です。

systemctl start sshd.service

一応、ファイアウォールを確認します。
firewall-cmd –list-all

使用可能であれば以下のように “クライアント名 ssh” で表示されます。
services: dhcpv6-client ssh


sshユーザ作成

ssh接続するユーザを作成します。

“useradd ユーザ名” です。

useradd sshuser

パスワードを設定します。

“passwd ユーザ名” です。

passwd sshuser




コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

© web.lab All Rights Reserved.