afparg

afparg — AFPサーバーにコマンドを送信する

概要

afparg [-1234567Vv] [-A uam] [-h host] [-p port] [-s volume] [-u user] [-w password] [-f command]

afparg -l

説明

afparg は、認証されたユーザーで AFP サーバーにコマンドを送信するためのシンプルなツールである。 サーバー上のファイルを検査したり、簡単なファイル操作を実行したりするために使用できる。

使用可能なコマンドとその引数の一覧を表示するには、afparg -l を実行してください。

オプション

-1 : AFP 2.1プロトコルバージョンを使用する

-2 : AFP 2.2プロトコルバージョンを使用する

-3 : AFP 3.0プロトコルバージョンを使用する

-4 : AFP 3.1プロトコルバージョンを使用する

-5 : AFP 3.2プロトコルバージョンを使用する

-6 : AFP 3.3プロトコルバージョンを使用する

-7 : AFP 3.4プロトコルバージョンを使用する

-A uam : 指定された UAM 名またはエイリアスで認証を選択する。 レガシーの ClearTxt ログインパスには clrtxt、DHCAST128 には dhx、DHX2 には dhx2 を使用する。

-f コマンド 引数 : 実行するコマンド

-h host : サーバーのホスト名またはIPアドレス(デフォルト: localhost)

-l : 利用可能なコマンドを一覧表示して終了する

-p port : サーバーポート番号(デフォルト: 548)

-u user : AFPサーバーの認証用のユーザー名(デフォルト: 現在のuid)

-v : 詳細出力

-V : 超詳細出力

-w password : AFPサーバーの認証用のパスワード

設定

デフォルトでは、afparg は ClearTxt を使用する。-A clrtxt は、同じレガシーのログインパスを明示的に選択する。対応するネイティブ暗号化 UAM を使用するには、-A dhx または -A dhx2 を渡す。選択した UAM は、netatalk の afp.conf で構成する:

[Global]
uam list = uams_dhx.so uams_dhx2.so uams_clrtxt.so

例

利用可能なコマンドとその引数を一覧表示する

$ afparg -l
FPResolveID CNID
FPEnumerate dir
FPCopyFile source dest
FPLockrw d | r file [seconds]
FPLockw d | r file [seconds]
FPWrite file content
FPRead file
FPSetEA file attribute value
FPGetEA file attribute
FPSetInhibit file on | off
FPByteLockHold d | r file seconds

CNIDをファイル名に解決する

$ afparg -h 10.0.0.8 -u myuser -w mypass -s "test volume" -f FPResolveID 18
======================
FPResolveID with args:
Trying to resolve id 18
Resolved ID 18 to: 'AFP_Reference.pdf'

共有ボリューム上のディレクトリ内のファイルを一覧表示する

$ afparg -h 10.0.0.8 -u myuser -w mypass -s "test volume" -f FPEnumerate "my dir"
file1
file2

共有ボリューム上のファイルのコピーを作成する

$ afparg -h 10.0.0.8 -u myuser -w mypass -s "test volume" -f FPCopyFile AFP_Reference.pdf AFP_Reference2.pdf
======================
FPCopyFile with args:
source: "AFP_Reference.pdf" -> dest: "AFP_Reference2.pdf"

ファイルのデータフォークを読み取り/書き込みロックで開く。オプションの秒数引数がない場合、フォークは中断されるまで保持される(Ctrl-C)。それがある場合、フォークはその秒数だけ保持され、その後、適切な AFP ログアウトで正常に閉じられる。

$ afparg -h 10.0.0.8 -u myuser -w mypass -s "test volume" -f FPLockrw d AFP_Reference2.pdf 10
======================
FPOpen with read/write lock
source: "AFP_Reference2.pdf"

ファイルに文字列を書き込み、読み戻し、拡張属性を交換する — クロスプロトコルチェックのためのスクリプト可能なワンショット

$ afparg -h 10.0.0.8 -u myuser -w mypass -s "test volume" -f FPWrite note.txt "hello"
$ afparg -h 10.0.0.8 -u myuser -w mypass -s "test volume" -f FPRead note.txt
DATA:hello
$ afparg -h 10.0.0.8 -u myuser -w mypass -s "test volume" -f FPSetEA note.txt color red
$ afparg -h 10.0.0.8 -u myuser -w mypass -s "test volume" -f FPGetEA note.txt color
EA:red

ファイルの DeleteInhibit 属性を設定またはクリアする

afparg -h 10.0.0.8 -u myuser -w mypass -s "test volume" -f FPSetInhibit note.txt on

ファイルのデータフォークに対して AFP バイト範囲ロック(バイト 0-7)を 10 秒間保持し、その後、ロックを解除して正常に閉じる

afparg -h 10.0.0.8 -u myuser -w mypass -s "test volume" -f FPByteLockHold d note.txt 10

関連項目

afp_logintest(1), afp_spectest(1), afpd(8)