ssh
スポンサーリンク
何するコマンド?
他のコンピュータに接続するときに使うコマンド
書き方
ssh [オプション] [ユーザ名@] [相手先ホスト] [実行するコマンド]
オプション
| オプション | 説明 |
|---|---|
| -1 | SSHのプロトコルVersion1を使うよ |
| -2 | SSHのプロトコルVersion2を使うよ |
| -4 | IPv4を使うよ |
| -6 | IPv6を使うよ |
| -A | 認証エージェントの転送を許可するよ。でも取扱いには注意してね |
| -a | 認証エージェントの転送を禁止するよ |
| -b【bind_address】 | うんちゃらかんちゃら Use bind_address on the local machine as the source address of the connection. Only useful on systems with more than one address. |
| -C | やりとりするデータを圧縮しろや!って命令するよ。できるかどうかは知らんけど |
| -c【暗号方式】 | 【暗号方式】で暗号化してね |
| -D【[bind_address:]port】 | うんちゃらかんちゃら Specifies a local “dynamic” application-level port forwarding. This works by allocating a socket to listen to port on the local side, optionally bound to the specified bind_address. Whenever a connection is made to this port, the connection is forwarded over the secure channel, and the application protocol is then used to determine where to connect to from the remote machine. Currently the SOCKS4 and SOCKS5 protocols are supported, and ssh will act as a SOCKS server. Only root can forward privileged ports. Dynamic port forwardings can also be specified in the configuration file. IPv6 addresses can be specified with an alternative syntax: [bind_address/]port or by enclosing the address in square brackets. Only the superuser can forward privileged ports. By default, the local port is bound in accordance with the GatewayPorts setting. However, an explicit bind_address may be used to bind the connection to a specific address. The bind_address of “localhost” indicates that the listening port be bound for local use only, while an empty address or ‘*’ indicates that the port should be available from all interfaces. |
| -e【文字】 | 【文字】をエスケープ文字として使うよ |
| -F【ファイル名】 | 【ファイル名】を設定ファイルとして使うよ |
| -f | コマンド実行前にバックグラウンドに行けって命令するよ Requests ssh to go to background just before command execution. This is useful if ssh is going to ask for passwords or passphrases, but the user wants it in the background. This implies -n. The recommended way to start X11 programs at a remote site is with something like ssh -f host xterm. |
| -g | リモートホストから転送されたローカルなポートに接続していーよ。つまりどういうこと? Allows remote hosts to connect to local forwarded ports. |
| -I【smartcard_device】 | うんちゃらかんちゃら Specify the device ssh should use to communicate with a smartcard used for storing the user’s private RSA key. This option is only available if support for smartcard devices is compiled in (default is no support). |
| -i【ファイル名】 | 【ファイル名】を秘密鍵のファイルとして使うよ |
| -k | GSSAPIうんちゃらの転送を許可しないよ Disables forwarding (delegation) of GSSAPI credentials to the server. |
| -L【ポート番号】:【相手先ホスト】:【相手先ホストのポート番号】 | ローカルホストの【ポート番号】に対する接続を【相手先ホスト】の【相手先ホストのポート番号】に転送するよ |
| -l【ユーザ名】 | 【ユーザ名】でログインするよ |
| -M | 共有接続のためにmasterモードにしますよ?よく分からん Places the ssh client into “master” mode for connection sharing. Multiple -M options places ssh into “master” mode with confirmation required before slave connections are accepted. Refer to the description of ControlMaster in ssh_config(5) for details. |
| -m【mac_spec】 | うんちゃらかんちゃら Additionally, for protocol version 2 a comma-separated list of MAC (message authentication code) algorithms can be specified in order of preference. See the MACs keyword for more information. |
| -N | リモートコマンドを実行しないよ Do not execute a remote command. This is useful for just forwarding ports (protocol version 2 only). |
| -n | コマンドの入力を「/dev/null」から取るよ。つまり入力なしでコマンドを実行するよ |
| -O【制御コマンド】 | マスタープロセスとやらから分岐した現在の接続をコントロールするよ。うんちゃらかんちゃら Control an active connection multiplexing master process. When the -O option is specified, the ctl_cmd argument is interpreted and passed to the master process. Valid commands are: “check” (check that the master process is running) and “exit” (request the master to exit). |
| -o【オプション】 | 設定ファイルと同じ形式でオプションを追加できまっせ。なんかいっぱいあるから説明は他のところで見てね。ちなみに使えるオプションは以下の通りだよ AddressFamily BatchMode BindAddress ChallengeResponseAuthentication CheckHostIP Cipher Ciphers ClearAllForwardings Compression CompressionLevel ConnectionAttempts ConnectTimeout ControlMaster ControlPath DynamicForward EscapeChar ForwardAgent ForwardX11 ForwardX11Trusted GatewayPorts GlobalKnownHostsFile GSSAPIAuthentication GSSAPIDelegateCredentials HashKnownHosts Host HostbasedAuthentication HostKeyAlgorithms HostKeyAlias HostName IdentityFile IdentitiesOnly KbdInteractiveDevices LocalCommand LocalForward LogLevel MACs NoHostAuthenticationForLocalhost NumberOfPasswordPrompts PasswordAuthentication PermitLocalCommand Port PreferredAuthentications Protocol ProxyCommand PubkeyAuthentication RekeyLimit RemoteForward RhostsRSAAuthentication RSAAuthentication SendEnv ServerAliveInterval ServerAliveCountMax SmartcardDevice StrictHostKeyChecking TCPKeepAlive Tunnel TunnelDevice UsePrivilegedPort User UserKnownHostsFile VerifyHostKeyDNS XAuthLocation |
| -p【ポート番号】 | 【ポート番号】ポートに接続するよ |
| -q | 警告メッセージとかを表示しないよ |
| -R【ポート番号】:【相手先ホスト】:【相手先ホストのポート番号】 | 【相手先ホスト】の【相手先ホストのポート番号】に対する接続をローカルホストの【ポート番号】に転送するよ |
| -S【ctl_path】 | うんちゃらかんちゃら Specifies the location of a control socket for connection sharing. Refer to the description of ControlPath and ControlMaster in ssh_config(5) for details. |
| -s | うんちゃらかんちゃら May be used to request invocation of a subsystem on the remote system. Subsystems are a feature of the SSH2 protocol which facilitate the use of SSH as a secure transport for other applications (eg. sftp(1)). The subsystem is specified as the remote command. |
| -T | 端末を割り当てないよ Disable pseudo-tty allocation. |
| -t | 強制的に端末を割り当てるよ Force pseudo-tty allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g., when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty. |
| -V | バージョン情報とかを表示するよ |
| -v | デバッグメッセージとかを表示するよ。vは3つまで追加して「-v」「-vv」「-vvv」って書けるよ。「v」が多いほどいろんなメッセージを表示するよ |
| -w【tunnel:tunnel】 | うんちゃらかんちゃら Requests a tun(4) device on the client (first tunnel arg) and server (second tunnel arg). The devices may be specified by numerical ID or the keyword “any”, which uses the next available tunnel device. See also the Tunnel directive in ssh_config(5). |
| -X | X11転送とやらを有効にするよ |
| -x | X11転送とやらを無効にするよ |
| -Y | 信頼されたX11転送とやらを有効にするよ Enables trusted X11 forwarding. Trusted X11 forwardings are not subjected to the X11 SECURITY extension controls. |
補足事項
基本的な使いどころは「telnet」コマンドと同じです。
telnetさんが通信内容を暗号化しないのに対し、SSHさんは通信内容を暗号化します。
そこでtelnetさんよりSSHさんが持てはやされるようになり、今まで「telnet」コマンドを使っていたシーンで「ssh」コマンドが使われるようになったのです。
世代交代でsshがtelnetに取って代わったと思ってください。
telnetのニュータイプがsshです。
