« Outbound Port25 Blocking | メイン | Perl コマンドラインスイッチ -w »

2005年05月25日

rbash - restricted shell

リモートからSSH接続し、Xrea.com さんのサーバー管理に利用できるシェルは 制限付きのシェル(制限シェル) restricted shell rbash です。

管理メニュー「ホスト情報登録」⇒ SSH登録
 · SSHシェルはデータベース操作の時のみお使い下さい。

[2005/8/31 追記] SSH接続時の制限緩和(仮)について(2005/06/22)
  http://sb.xrea.com/showthread.php?t=9700
実験的な制限緩和「・・・基本的に通常のシェル機能がほぼすべてご利用いただけます・・・」中とのことです。

  「Manpage of BASH」
    http://www.linux.or.jp/JM/html/GNU_bash/man1/bash.1.html
の中に「制限付きのシェル(RESTRICTED SHELL)」の翻訳がありますので、全文引用させていただきます。原文として、
    http://www.network-theory.co.uk/docs/bashref/bashref_68.html
を引用・対比し、強調個所は当方で追記した文章です。

===
Bash を rbash という名前で起動した場合や、起動時に --restricted または -r オプションを指定した場合には、シェルは制限された状態になります。制限付きのシェルは、標準のシェルよりも細かく制御された環境を設定したいときに用います。制限付きのシェルは bash と全く同じように動作しますが、以下のようなことが許可されなかったり実行されなかったりします:
If Bash is started with the name rbash, or the --restricted or -r option is supplied at invocation, the shell becomes restricted. A restricted shell is used to set up an environment more controlled than the standard shell. A restricted shell behaves identically to bash with the exception that the following are disallowed or not performed:

● cd を使ってディレクトリを変更すること
Changing directories with the cd builtin.

● SHELL, PATH, ENV, BASH_ENV の値の設定や設定取り消しを行なうこと
Setting or unsetting the values of the SHELL, PATH, ENV, or BASH_ENV variables.

● / を含むコマンド名を指定すること
Specifying command names containing slashes.

● 組み込みコマンド . の引き数として / を含むファイル名を指定すること
Specifying a filename containing a slash as an argument to the . builtin command.

● 組み込みコマンド hash に対するオプション -p の引数として / を含むファイル名を指定すること
Specifying a filename containing a slash as an argument to the -p option to the hash builtin command.

● 起動時にシェル環境から関数定義をインポートすること
Importing function definitions from the shell environment at startup.

● 起動時にシェル環境から SHELLOPTS の値を展開すること
Parsing the value of SHELLOPTS from the shell environment at startup.

● リダイレクション演算子 >, >|, <>, >&, &>, >> を使ってリダイレクトを行なうこと
Redirecting output using the '>', '>|', '<>', '>&', '&>', and '>>' redirection operators.

● 組み込みコマンド exec を用いて、シェルを別のコマンドに置き換えること
Using the exec builtin to replace the shell with another command.

● 組み込みコマンド enable に対する -f オプションと -d オプションを使って、組み込みコマンドを追加・削除すること
Adding or deleting builtin commands with the -f and -d options to the enable builtin.

利用できないシェルを使用可能とするために組み込みコマンド enable を使うこと
Using the enable builtin command to enable disabled shell builtins.

● 組み込みコマンド command に -p オプションを指定すること
Specifying the -p option to the command builtin.

● set +r や set +o restricted を用いて制限モードを解除すること
Turning off restricted mode with 'set +r' or 'set +o restricted'

これらの制限は、何らかの起動ファイルを読み込んだ後に適用されます。
These restrictions are enforced after any startup files are read.

シェルスクリプトであると判明したファイルが実行された時(3.8 シェルスクリプトのセクションを参照)、rbash はスクリプトを実行するために立ち上げたシェルでは制限を全て無効にします。
When a command that is found to be a shell script is executed (see section 3.8 Shell Scripts), rbash turns off any restrictions in the shell spawned to execute the script.

投稿者 mvtp : 2005年05月25日 11:18

トラックバック

このエントリーのトラックバックURL:
trackbacklink 57

コメント

コメントしてください

サイン・インを確認しました、 . さん。コメントしてください。 (サイン・アウト)

(いままで、ここでコメントしたとがないときは、コメントを表示する前にこのウェブログのオーナーの承認が必要になることがあります。承認されるまではコメントは表示されません。そのときはしばらく待ってください。)


情報を登録する?




 Modified by Toshiaki YAMAMURA    Powered by Movable Type
 ■シックス・アパート株式会社より「個人用ライセンス」を取得し、Movable Type にて情報提供中です. ■ハンドル名とメールアドレスを入力すると、自由にコメント投稿できます. 但し、15歳未満のお子供は必ず保護者の指導・監督下で行って下さい. ■本ウエブログでは、サイト管理・運営者が著しく不利益と判断するコメントや他人を誹謗中傷するコメントは、直ちに削除いたします.