
Ubuntu,Debian,CentOS,Fedora対応
sshコマンドの書式
書式1 |
---|
ssh [オプション] [ログイン先ユーザ名@] ログイン先ホスト名 [コマンド] |
書式2 |
---|
ssh [-l ログイン先ユーザ名] ログイン先ホスト名 [コマンド] |
sshコマンドの主なオプション
オプション | 説明 |
---|---|
-l (user) | リモートホストでのユーザ名(user)が現在のホストでのユーザ名と異なる場合。 (user)はログイン先のユーザ名。 |
-p | ポート番号を指定する。 指定しない場合は初期値の22で通信する。 |
sshコマンドの使用例
SSHでログインする
ホスト名os1.123-45678.example.co.jpにSSHでログインする。
$ ssh os1.123-45678.example.co.jp
user@os1.123-45678.example.co.jp’s password:
[user]$ ←リモートホストのプロンプト
特定ユーザー名でSSHログインする
ポート番号1234にユーザー名userへSSHでログインする。
$ ssh -p 1234 user@xxx.xxx.xxx.xxx
user@xxx.xxx.xxx.xxx’s password:
初めてsshでのログインを行うときには…
初めての接続のときには接続の許可を求められる。
$ ssh os1.123-45678.example.co.jp
user@os1.123-45678.example.co.jp’s password:
The authenticity of host ‘[os1.123-45678.example.co.jp] (xxx.xxx.xxx.xxx)’ can’t be established.
ECDSA key fingerprint is SHA256:aHbshla83250aDKahypaer2fu.
Are you sure you want to continue connecting (yes/no)?
sshの公開鍵認証について
sshではパスワード認証の他に公開鍵暗号を使った認証方法もある。
詳しくはSSH通信にて鍵認証でログインするを参照する。
参照元情報