OpenSSH の起動

インストールした OpenSSH サーバーを起動して動作の確認を行います。
また OpenSSH の自動起動スクリプトを作成し、OS 起動時に自動的に OpenSSH を起動するように設定します。

OpenSSH の起動と終了

OpenSSH は以下のように起動します。

# /usr/local/openssh/sbin/sshd

実行中のプロセスを表示させて OpenSSH が起動しているかを確認します。

# ps ax | grep sshd
19799 ?        Ss     0:00 /usr/local/openssh/sbin/sshd
19966 pts/0    S+     0:00 grep sshd

OpenSSH を停止する場合は kill コマンドを使って sshd のプロセスを終了させます。

# kill `cat /var/run/sshd.pid`

OpenSSH の自動起動スクリプト

OpenSSH の自動起動スクリプトを使うことで、サーバーマシンが起動するときに自動的に OpenSSH を起動させることができます。
OpenSSH の自動起動スクリプトは OpenSSH のソースファイル(contrib/redhat/sshd.init)に含まれています。
これを /etc/rc.d/init.d/sshd ファイルとしてコピーします。

# sed -e 's/\/etc\/ssh/\/usr\/local\/openssh\/etc/' -e 's/\/usr\/bin/\/usr\/local\/openssh\/bin/' -e 's/\/usr\/sbin/\/usr\/local\/openssh\/sbin/' /usr/local/src/openssh-4.5p1/contrib/redhat/sshd.init > /etc/rc.d/init.d/sshd

作成した自動起動スクリプトに実行権限を与えて自動起動設定を行います。

# chmod 755 /etc/rc.d/init.d/sshd
# chkconfig --add sshd

自動起動スクリプトを使って OpenSSH を起動する場合は以下のように実行します。

# /etc/rc.d/init.d/sshd start

自動起動スクリプトのダウンロード » sshd

カテゴリー
  • Fedora のインストール (24)
  • OpenSSH で SSH サーバー構築 (4)
  • NTP で時刻情報サーバー構築 (4)
  • Apache HTTP Server で Web サーバー構築 (32)
  • MySQL でデーターベースサーバー構築 (10)
  • PostgreSQL でデーターベースサーバー構築 (22)
  • PHP で Web アプリケーションサーバー構築 (4)
  • qmail でメールサーバー構築 (7)
  • Tomcat で Web アプリケーションサーバー構築 (3)
  • Samba でファイルサーバー構築 (3)
  • BIND でネームサーバー構築 (3)
  • ProFTPD で FTP サーバー構築 (5)
  • snort でネットワーク進入探知システム構築 (3)
  • CMS でサイト構築 (3)
  • ネットワーク設定 (3)
  • システム設定 (4)
  • ライブラリのインストール (8)
  • Debian GNU/Linux (26)
  • Ubuntu (17)
  • メモ (6)
  • このサイトについて (4)
  • 相互リンク (6)