Go to main content

マニュアルページ セクション 1: ユーザーコマンド

印刷ビューの終了

更新: 2022年7月27日
 
 

remsh(1)

名前

rsh, remsh, remote_shell - リモートシェル

形式

rsh [-n] [-l username] hostname command
rsh hostname [-n] [-l username] command
remsh [-n] [-l username] hostname command
remsh hostname [-n] [-l username] command
hostname [-n] [-l username] command

説明


Caution

注意  -  All data exchanges over this protocol are performed without encryption, and have no protection against spoofing or snooping of traffic.The in.rshd server is disabled by default on Oracle Solaris and most other modern operating systems, and both the in.rshd server and the rsh command may be removed in future versions of Oracle Solaris.Use of the ssh(1) utility is strongly recommended instead.


rsh は、hostname が示すホストに接続し、command が示すコマンドを実行します。rsh は自身の標準入力のデータをリモートコマンドにコピーし、リモートコマンドの標準出力を自身の標準出力にコピーし、さらに、リモートコマンドの標準エラー出力を 自身の標準エラー出力にコピーします。割り込み、停止、および終了シグナルは、リモートコマンドに伝えられます。通常 rsh は、リモートコマンドが終了したときに終了します。

command を省略すると、rsh は単一のコマンドを実行する代わりに、rlogin(1) を使ってそのユーザーをリモートホストにログインします。

rshcommand の終了ステータスを返しません。

シェルのメタキャラクタのうち、引用符で囲まれていないものはローカルマシン上で解釈されます。引用符で囲まれているものは、リモートマシン上で解釈されます。See EXAMPLES.

If there is no locale setting in the initialization file of the login shell (.profile, .cshrc, etc.) for a particular user, rsh always executes the command in the “C” locale instead of using the default locale of the remote machine.

オプション

サポートしているオプションは、次のとおりです。

–l username

リモートユーザー名として、ユーザー自身のローカルユーザー名の代わりに username を使用します。このオプションを省略すると、リモートユーザー名はローカルユーザー名と同じになります。

–n

rsh の入力先を /dev/null に変更します。このオプションは、rsh とそれを呼び出したシェルとの間での、予期できない干渉を防ぐ上で便利です。For example, if you are running rsh and invoke a rsh in the background without redirecting its input away from the terminal, it blocks even if no reads are posted by the remote command.–n オプションを指定すれば、このような事態は避けられます。

The type of remote shell (sh, csh, or other) is determined by the user's entry in the passwd(5) database on the remote system.

オペランド

次のオペランドを指定できます。

command

指定された hostname で実行するコマンド

使用法

rsh および remsh コマンドは、IPv6 に対応しています。See ip6(4P).

Hostnames are provided by the hosts(5) name service.各ホストには 1 つの正式名 (データべースエントリの最初の名前) があり、さらにいくつかのニックネームが存在することもあります。hostname には、正式ホスト名とニックネームのどちらでも指定できます。

rsh を実行するファイル名が rsh でなければ、rsh はそのファイル名を hostname 引数として使用します。これによりユーザーは、ホスト名で rsh に対するシンボリックリンクを生成でき、実行時にそのホスト上のリモートシェルを呼び出せます。ディレクトリを作成し、それを共通に使われる ホスト名でシンボリックリンクにつなぎ、さらにそのディレクトリをユーザー自身の シェルの検索パスに含めることにより、シェルに hostname を入力するだけで rsh を実行することができます。

rshremsh で呼び出した場合、rsh/usr/bin/remsh の存在を確認します。このファイルが存在 する場合、rshremshrsh の別名として処理します。/usr/bin/remsh が存在しない場合、rshremsh をホスト名として処理します。

セキュリティー保護されていない rsh セッションの場合、各リモートマシンで /etc/hosts.equiv という名のファイルを使用できます。このファイルには、そのマシンとユーザー名を共有する、信頼できるホスト名のリストが含まれています。ローカルマシン上とリモートマシン上でのユーザー名が同一のユーザーは、リモートマシンの /etc/hosts.equiv ファイルにリストされているマシンから rsh を実行することができます。Individual users can set up a similar private equivalence list with the file .rhosts in their home directories.このファイル中の各行には 2 つの名前、 hostname と username が含まれ、両者はスペースで区切られます。The entry permits the user named username who is logged into hostname to use rsh to access the remote machine as the remote user.ローカルホスト名がリモートマシン上の /etc/hosts.equiv ファイル中に見つからず、ローカルのユーザー名とホスト名がリモートユーザーの .rhosts ファイル中に見つからない場合、アクセスは拒否されます。/etc/hosts.equiv または .rhosts ファイルに記録されているホスト名は、hosts データべースに登録されている正式なホスト名である必要があります。つまりこの両ファイル中には、ニックネームは指定できません。

ユーザーアカウントがロックされていると、rsh を使用して、ホスト名からのユーザーとして ログインすることはできません。

リモートマシン上でアクセスが拒否されたときは、command 引数が省略されていない限り、rsh はパスワードの入力を要求するプロンプトを出力しません。

使用例 1 rsh でファイルを追加する

次のコマンドは、リモートのマシン lizard 上にあるファイル lizard.file を、ローカルのマシン example 上にあるファイル example.file に追加します。

example% rsh lizard cat lizard.file >> example.file

次のコマンドは、リモートのマシン lizard 上にあるファイル lizard.file を、同じマシン lizard 上にあるファイル lizard.file2 に追加します。

example% rsh lizard cat lizard.file ">>" lizard.file2

終了ステータス

次の終了ステータスが返されます。

0

Successful completion.

1

An error occurred.

ファイル

/etc/hosts.equiv

信頼性のあるリモートホストとユーザー

属性

属性についての詳細は、マニュアルページの attributes(7) を参照してください。

属性タイプ
属性値
使用条件
network/legacy-remote-utilities
CSI
Enabled
Interface Stability
Obsolete

関連項目

rlogin(1), ssh(1), telnet(1), ip6(4P), hosts(5), hosts.equiv(5), attributes(7), in.rshd(8)

hosts.equiv に登録されているシステムのセキュリティーは、少なくともローカルシステムのセキュリティーと 同レベルである必要があります。セキュリティーレベルの低いシステムが hosts.equiv 中に 1 つでも存在していると、システム全体のセキュリティーが損なわれる可能性があります。

You cannot run an interactive command, such as vi(1).Use ssh to start a remote login session if you wish to do this.

停止シグナルは、ローカルの rsh プロセスだけを停止させます。これはバグだという議論があるかもしれませんが、現在のところ修正が大変困難です。その理由は複雑なので、ここでは説明を省きます。

現在のローカル環境は、リモートシェルに引き渡されません。

–n オプションを使用すると、原因を特定できないような問題が発生することがあります。次に例を示します。

example% rsh somehost dd if=/dev/nrmt0 bs=20b | tar xvpBf −

このコマンドを実行すると、シェルの状態がおかしくなります。つまり rsh の前に tar が終了してしまい、The rsh command then tries to write into the “broken pipe” and, instead of terminating neatly, proceeds to compete with your shell for its standard input.–n オプションを指定して rsh を実行すれば、このような事態を防ぐことができます。

このバグは rsh がパイプラインの先頭で、標準入力を読み込まないときにだけ発生します。rsh が標準入力を読み込む必要があるときは、–n オプションを使用しないでください。For example:

example% tar cf − . | rsh sundial dd of=/dev/rmt0 obs=20b

この場合、前述のような現象は起こりません。この場合に –n オプションを指定すると、rsh はパイプから読み込む代わりに、誤って /dev/null からの読み込みを試みます。

History

Support for Kerberos, including the options –a, –f, –F, –k, –K, –PN, –PO, and –x, was added in Solaris 10 3/05 and removed in Oracle Solaris 11.4.0.Prior to Solaris 10, a kerberized version was available in the Sun Enterprise Authentication Mechanism (SEAM) add-on package for Solaris.

Support for IPv6 was added in Solaris 8.

The rsh command, including support for the options –l and –n, has been present since the initial release of Solaris.