2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

CentOS 7のsshdのポートを変えるとエラーが出る(備忘録)

Posted at

問題の概要

CentOS 7をインストールした直後、sshdのポートを変更しようとして、
sudo nano /etc/ssh/sshd_configを開きPort 22を任意のポート番号へ書き換え、
sudo systemctl restart sshdすると、次のようにエラーが出る

Job for sshd.service failed because the control process exited with error code. See "systemctl status sshd.service" and "journalctl -xe" for details.

何回も見たことあるエラーだ...

原因

SELinuxは正しく設定、または disabled にしましたか?

設定した後は再起動しましたか?(多くの原因はここ)
設定した後は再起動しましたか?
設定した後は再起動しましたか?

設定した後は再起動しましたか?(多くの原因はここ)

対処法

  • SELinuxを正しく設定しなおすか無効化する

nano /etc/selinux/config

SELINUX=disabled
編集後はCtrl+X → y で保存

  • 必ず再起動する
  • 必ず再起動する
  • 必ず再起動する
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?