Name

rpcclient — クライアント側の MS-RPC 関数を発行するツール

Synopsis

rpcclient [-A authfile] [-c <command string>] [-d debuglevel] [-h] [-l logdir] [-N] [-s <smb config file>] [-U username[%password]] [-W workgroup] [-N] [-I destinationIP] {server}

説明

このツールは samba(7) システムの一部である。

rpcclient は Samba の MS-RPC 機能をテストするために開発されたユーティリティであり、 開発と安定を何度か繰り返している。 多数のシステム管理者がこのツールを用いて UNIX ワークステーションから Windows NT クライアントを管理するスクリプトを作成している。

オプション

server

接続先のサーバを NetBIOS 名で指定する。 サーバは SMB/CIFS サーバである必要がある。 この名前の解決には smb.conf(5 ) ファイルの name resolve order パラメータが用いられる。

-c|--command='command string'

実行するコマンド (以下で記述) をセミコロンで区切って指定する。

-I IP-address

IP address は接続先の サーバのアドレスを指定する。記述方法は、標準的な "a.b.c.d" のフォーマットで指定する。

通常、クライアントは上記の name resolve order パラメータで指定された名前解決の機能を使用して NetBIOS 名を検索し、SMB/CIFS サーバを特定する。 このパラメータを使用することで、クライアントに対し強制的に 指定された IP Address にサーバがあると認識させ、接続しようとしているリソースの NetBIOS 名を無視させることができる。

このパラメータにデフォルトの値はない。 もしこの値が指定されていないのなら、上で述べたようにクライアントが 自動的に判別する。

-d|--debuglevel=level

level is an integer from 0 to 10. The default value if this parameter is not specified is 0.

The higher this value, the more detail will be logged to the log files about the activities of the server. At level 0, only critical errors and serious warnings will be logged. Level 1 is a reasonable level for day-to-day running - it generates a small amount of information about operations carried out.

Levels above 1 will generate considerable amounts of log data, and should only be used when investigating a problem. Levels above 3 are designed for use only by developers and generate HUGE amounts of log data, most of which is extremely cryptic.

Note that specifying this parameter here will override the log level parameter in the smb.conf file.

-V

Prints the program version number.

-s <configuration file>

The file specified contains the configuration details required by the server. The information in this file includes server-specific information such as what printcap file to use, as well as descriptions of all the services that the server is to provide. See smb.conf for more information. The default configuration file name is determined at compile time.

-l|--log-basename=logdirectory

Base directory name for log/debug files. The extension ".progname" will be appended (e.g. log.smbclient, log.smbd, etc...). The log file is never removed by the client.

-N

If specified, this parameter suppresses the normal password prompt from the client to the user. This is useful when accessing a service that does not require a password.

Unless a password is specified on the command line or this parameter is specified, the client will request a password.

If a password is specified on the command line and this option is also defined the password on the command line will be silently ingnored and no password will be used.

-k

Try to authenticate with kerberos. Only useful in an Active Directory environment.

-A|--authentication-file=filename

This option allows you to specify a file from which to read the username and password used in the connection. The format of the file is

username = <value>
password = <value>
domain   = <value>

Make certain that the permissions on the file restrict access from unwanted users.

-U|--user=username[%password]

Sets the SMB username or username and password.

If %password is not specified, the user will be prompted. The client will first check the USER environment variable, then the LOGNAME variable and if either exists, the string is uppercased. If these environmental variables are not found, the username GUEST is used.

A third option is to use a credentials file which contains the plaintext of the username and password. This option is mainly provided for scripts where the admin does not wish to pass the credentials on the command line or via environment variables. If this method is used, make certain that the permissions on the file restrict access from unwanted users. See the -A for more details.

Be cautious about including passwords in scripts. Also, on many systems the command line of a running process may be seen via the ps command. To be safe always allow rpcclient to prompt for a password and type it in directly.

-n <primary NetBIOS name>

This option allows you to override the NetBIOS name that Samba uses for itself. This is identical to setting the netbios name parameter in the smb.conf file. However, a command line setting will take precedence over settings in smb.conf.

-i <scope>

This specifies a NetBIOS scope that nmblookup will use to communicate with when generating NetBIOS names. For details on the use of NetBIOS scopes, see rfc1001.txt and rfc1002.txt. NetBIOS scopes are very rarely used, only set this parameter if you are the system administrator in charge of all the NetBIOS systems you communicate with.

-W|--workgroup=domain

Set the SMB domain of the username. This overrides the default domain which is the domain defined in smb.conf. If the domain specified is the same as the servers NetBIOS name, it causes the client to log on using the servers local SAM (as opposed to the Domain SAM).

-O socket options

TCP socket options to set on the client socket. See the socket options parameter in the smb.conf manual page for the list of valid options.

-h|--help

Print a summary of command line options.

コマンド

LSARPC

lsaquery

info policy を問い合わせる。

lookupsids

リストされた SID からユーザ名を解決する。

lookupnames

リストされたユーザ名から SID を解決する。

enumtrusts

信頼するドメインの一覧を表示する。

enumprivs

ユーザ権利の一覧を表示する。

getdispname

ユーザ権利の名前を取得する。

lsaenumsid

LSA の SID の一覧を表示する。

lsaenumprivsaccount

指定した SID の持つユーザ権利を一覧表示する。

lsaenumacctrights

指定されたユーザ権利を持つ SID を一覧表示する。

lsaenumacctwithright

指定されたユーザ権利を持つアカウントを一覧表示する。

lsaaddacctrights

アカウントにユーザ権利を追加する。

lsaremoveacctrights

アカウントからユーザ権利を取り除く。

lsalookupprivvalue

ユーザ権利の名前から値を取得する。

lsaquerysecobj

LSA セキュリティオブジェクトを問い合わせる。

LSARPC-DS

dsroledominfo

プライマリドメインの情報を取得する。

DFS

dfsexist

DFS をサポートしているか問い合わせる。

dfsadd

DFS の共有を追加する。

dfsremove

DFS の共有を削除する。

dfsgetinfo

DFS の共有の情報を問い合わせる。

dfsenum

DFS の共有の一覧を表示する。

REG

shutdown

遠隔操作でシャットダウンさせる。

abortshutdown

シャットダウンを中止させる。

SRVSVC

srvinfo

サーバ情報を問い合わせる。

netshareenum

共有を一覧表示する。

netfileenum

開いているファイルを一覧表示する。

netremotetod

リモートサーバの時間を取得する。

SAMR

queryuser

ユーザ情報を問い合わせる。

querygroup

グループ情報を問い合わせる。

queryusergroups

ユーザが所属するグループを問い合わせる。

querygroupmem

グループに所属するメンバーを問い合わせる。

queryaliasmem

エイリアスに所属するメンバーを問い合わせる。

querydispinfo

ユーザ情報の一覧を表示する。

querydominfo

ドメイン情報を問い合わせる。

enumdomusers

ドメインユーザを一覧表示する。

enumdomgroups

ドメイングループを一覧表示する。

enumalsgroups

エイリアスグループ(ローカルグループ)を一覧表示する。

createdomuser

ドメインユーザを作成する。

samlookupnames

名前を検索する。

samlookuprids

rid を検索する。

deletedomuser

ドメインユーザを削除する。

samquerysecobj

SAMR セキュリティオブジェクトを問い合わせる。

getdompwinfo

ドメインパスワード情報を取得する

lookupdomain

ドメイン情報を検索する

SPOOLSS

adddriver <arch> <config> [<version>]

プリンタドライバ情報をサーバに登録するために AddPrinterDriver() RPC の呼び出しを行なう。ドライバファイルは getdriverdir コマンドが返却するディレクトリ中に予め存在している必要が ある。arch に設定できる値は getdriverdir コマンドで取得できる値と同じである。 config パラメータでは以下の形式のファイルを 指定する。

Long Printer Name:\
Driver File Name:\
Data File Name:\
Config File Name:\
Help File Name:\
Language Monitor Name:\
Default Data Type:\
Comma Separated list of Files

空のフィールドには、"NULL" という文字列を指定しておくこと。

Samba は Print Monitor 機能をサポートする必要がない。 これは、この機能が双方向通信を利用するドライバを使うローカルプリンタにしか関係しないためである。 このフィールドは必ず「NULL」にしておくこと。 遠隔の NT プリントサーバにコマンドを発行する場合、 ドライバの Print Monitor 機能をドライバの追加前にインストールしていないと、 RPC に失敗する。

version パラメータにより、プリンタドライバのバージョン番号が指定される。 省略した場合、アーキテクチャに応じたバージョンが用いられる。 このオプションは Windows 2000 (バージョン 3)のプリンタドライバのアップロードに用いることができる。

addprinter <printername> <sharename> <drivername> <port>

遠隔のサーバ上にプリンタを追加する。このプリンタは自動的に共有される。 このコマンドを実行する前に、プリンタドライバをサーバ上にインストール して (adddriver を参照のこと)、port を有効なポート名にしておく (enumports を参照) 必要があることに注意。

deldriver

指定されたプリンタドライバについて、すべてのアーキテクチャ用のものを削除する。これは、 ドライバのファイル自体をサーバから削除するわけではなく、 サーバのドライバのリストからエントリだけを削除するものである。

deldriverex <driver> [architecture] [version]

指定されたプリンタドライバについて、ドライバファイルも含めて削除する。 削除対象のバージョンやアーキテクチャを指定することも可能である。 アーキテクチャが指定されなかった場合、すべてのドライバファイルが削除される。

enumdata

サーバ上に格納されているプリンタの設定情報を一覧表示する。Windows NT クライアントの場合、 これらの情報はレジストリに格納されているが、Samba サーバの場合、 プリンタ用の TDB ファイル中に格納されている。このコマンドは、 Microsoft Platform SDK 中にある GetPrinterData() 関数に相当する。 (このコマンドは現在実装されていない)

enumdataex

キーに基づいたプリンタの情報を表示する。

enumjobs <printer>

指定されたプリンタのジョブおよびその状況を表示する。 このコマンドは、Microsoft Platform SDK 中の EnumJobs() 関数に相当する。

enumkey

プリンタキーを 一覧表示する。

enumports [level]

指定された info level でEnumPorts() 関数を呼び出す。現在、info level 1 と 2 のみがサポートされている。

enumdrivers [level]

EnumPrinterDrivers() を実行する。これは全てのアーキテクチャ用の インストールされたドライバの一覧を表示する。フラグとオプションの 詳細については、Microsoft Platform SDK のドキュメントを参照のこと。 現在、info level 1, 2, 3 のみがサポートされている。

enumprinters [level]

EnumPrinters() を実行する。これは共有されている インストール済プリンタの一覧を表示する。フラグとオプションの詳細に ついては、Microsoft Platform SDK のドキュメントを参照のこと。 現在、info level 1, 2, 5 のみがサポートされている。

getdata <printername> <valuename;>

指定されたプリンタの設定情報を取得する。 詳細な情報に付いては、enumdata コマンドを参照のこと。 このコマンドは Microsoft Platform SDK 中の GetPrinterData() に相当するものである。

getdataex

キー名に基づいた プリンタドライバのデータを取得する。

getdriver <printername>

指定されたプリンタのプリンタドライバの情報 (ドライバファイル、 設定ファイル、関連するファイルなど) を取得する。このコマンドは Microsoft Platform SDK 中の GetPrinterDriver() に相当するものである。 現在、info level 1, 2, 3 のみがサポートされている。

getdriverdir <arch>

GetPrinterDriverDirectory() RPC を発行して、SMB 共有名と指定された アーキテクチャ用のプリンタドライバの格納されているサブディレクトリを 取得する。arch に指定できる値は、 "Windows 4.0" (for Windows 95/98), "Windows NT x86", "Windows NT PowerPC", "Windows Alpha_AXP", "Windows NT R4000" である。

getprinter <printername>

現在のプリンタ情報を取得する。このコマンドは Microsoft Platform SDK の GetPrinter() に相当する。

getprintprocdir

print processor ディレクトリを取得する。

openprinter <printername>

指定したプリンタに対して、OpenPrinterEx() と ClosePrinter() RPC を実行する。

setdriver <printername> <drivername>

SetPrinter() コマンドを実行して、既にインストール されているプリンタ用のプリンタドライバを更新する。 更新されるプリンタドライバは、プリントサーバ上に適切にインストール されている必要がある。

インストールされているプリンタやドライバの一覧を取得する方法に ついては enumprintersenumdrivers コマンドも参照のこと。

addform

フォームを追加する。

setform

フォームを設定する。

getform

フォームを取得する。

deleteform

フォームを削除する。

enumforms

フォームを 一覧表示する。

setprinter

プリンタのコメントを 設定する。

setprinterdata

REG_SZ プリンタデータを設定する。

setprintername <printername> <newprintername>

プリンタ名を設定する。

rffpcnex

Rffpcnex テストを実行する。

NETLOGON

logonctrl2

Logon Control 2 に変更する。

logonctrl

Logon Control に変更する。

samsync

Sam Synchronisation をはかり、結果を表示する。

samdeltas

Sam Delta Synchronisation をはかり、結果を表示する。

samlogon

ドメインユーザでログオンする。

共通コマンド

debuglevel

現在の debug level を設定する。これはログ情報の書き込みに影響する。

help (?)

コマンド一覧の表示と、 幾つかのコマンドに付いての詳細な説明を表示する。

quit (exit)

rpcclient を終了させる。

バグ

rpcclient は開発者のテストツールとしての利用を 念頭に置いているため、あまり動作が安定していない部分 (コマンドラインの解析など) もある。無効なパラメータを解析しようとすると、 失敗してコアダンプするのは既知の不具合である。

Luke Leighton のオリジナルの rpcclient マニュアルページより:

警告! SMB 上の MSRPC コードは ネットワークトレースを行なうことで開発されている。オリジナルの開発者 (Microsoft) からは、SMB 上で MSRPC がどのように動作するか、 個々の MSRPC サービスがどのように動作するかについての情報は提供されていない。 これらのサービスに関する Microsoft の実装も、場所によってはかなり風変わりで あることが明らかになっている。

同様に Samba への実装も場あたり的な面がある。 多くのサービスの実装が解明されるにつれて、smbd (8)rpcclient(1) は、幾つかのコマンドやサービスにおいてバージョン間の互換性が なくなることもありうる。なお、開発者達は発見した問題を Microsoft に対してレポートしており、報告された問題はサービスパックで修正されているが、 その結果互換性が損なわれることがあるかもしれない。

バージョン

このマニュアルページは Samba バージョン 3 用である。

作者

オリジナルの Samba ソフトウェアと関連するユーティリティは、 Andrew Tridgell によって作成された。現在 Samba は Samba Team によって、 Linux カーネルの開発と同様のオープンソースプロジェクトとして開発が 行なわれている。

オリジナルの rpcclient マニュアルページは Matthew Geddes と Luke Keneth Casson Leighton によって作成され、 Gerald Carter によって書き直された。 Samba 2.2 における DocBook 形式への変換は、Gerald Carter によって行なわれた。Samba 3.0 における DocBook XML 4.2 形式への変換は Alexander Bokovoy によって行われた。

日本語訳

このマニュアルページは Samba 3.0.23 - Samba 3.2.4-3.2.9 対応のものである。

このドキュメントの Samba 3.0.0 対応の翻訳は

  • 高橋 基信 (monyo@samba.gr.jp)

  • はせがわ ようすけ

  • 山田 史朗 (shiro@miraclelinux.com)

によって行なわれた。

Samba 3.0.23 - Samba 3.2.4-3.2.9 対応の翻訳は、たかはしもとのぶ (monyo@samba.gr.jp) によって行なわれた。