3流プログラマのメモ書き

元開発職→社内SE→派遣で営業支援の三流プログラマのIT技術メモ書き。 このメモが忘れっぽい自分とググってきた技術者の役に立ってくれれば幸いです。(jehupc.exblog.jpから移転中)

(SunRay)SunRayサーバ上のスマートカードのトークンをコマンドで登録

SunRaySoftwareServerを別サーバ機に移行することになりました。

それで、スマートカードトークンの情報を新しいSunRayサーバに簡単に取り込む方法について調べてみました。

ググるSun Ray Server Software - utuser の便利な使い方 (やっぱり Sun がスキ!)にやり方が載っていました。

utuser コマンドを使うことでいろいろできるようです。

一つのトークンの登録

まず、一つのトークンを登録する場合は utuser -a を使います。

以下の様な感じです。

# /opt/SUNWut/sbin/utuser -a "トークンID, サーバ名, サーバポート(大抵は7007), ユーザ名, その他の情報"

5項目をカンマ区切りで、全体をダブルクォーテーションで括ってやる必要があります。

複数のトークンの同時登録

一気に複数のトークンを登録することも可能です。

その場合、トークン情報を以下の書式で別ファイルに書きだしておき、utuser -af コマンドを使います。

トークン情報を書いた userlist.csv

Payflex.999999a800130100 , localhost , 7007, user001 , 管理者用

Payflex.999999a900130100 , localhost , 7007, user002 , テストユーザ

Payflex.999999aa00130100 , localhost , 7007, user005 ,

Payflex.999999ab00130100 , localhost , 7007, user101 ,

Payflex.999999ac00130100 , localhost , 7007, user102 ,

Payflex.999999ad00130100 , localhost , 7007, user103 , テストユーザ

# /opt/SUNWut/sbin/utuser -af userlist.csv

Added user001

Added user002

Added user005

Added user101

Added user102

Added user103

(トークンの一括変更には、 /opt/SUNWut/sbin/utuser -ef userlist.csv を使います)

既に登録されていたりすると、以下の様なエラーが表示されます。

Error: line 96: Token 'Payflex.999999a800130100' is already in the adminstration database....skipping

最後の一行はどうやら改行が必要なようです。そうしないと以下のエラーがでました。

Error: Line '504' in file '/Desktop/userlist.csv' too long

トークン情報の表示

登録したユーザの状況は、 utuser -l コマンドで確認できるようです。

# /opt/SUNWut/sbin/utuser -l

Token ID User Name Other Info

------------------------------ ------------------------------ ---------------

Payflex.999999a800130100 user001 管理者用

Payflex.999999a900130100 user002 テストユーザ

Payflex.999999aa00130100 user005

Payflex.999999ab00130100 user101

Payflex.999999ac00130100 user102

Payflex.999999ad00130100 user103 テストユーザ

さらに詳しいトークン情報(サーバ名やポート番号を付加した場合)を表示したい場合は utuser -L を使います。

# /opt/SUNWut/sbin/utuser -L

Token ID Server Port User Name Session Type Other Info

------------------------------ --------------- ----- ------------------------------ --------------- ---------------

Payflex.999999a800130100 localhost 7007 user001 default 管理者用

Payflex.999999a900130100 localhost 7007 user002 default テストユーザ

Payflex.999999aa00130100 localhost 7007 user005 default

Payflex.999999ab00130100 localhost 7007 user101 default

Payflex.999999ac00130100 localhost 7007 user102 default

Payflex.999999ad00130100 localhost 7007 user103 default テストユーザ

これをファイルにリダイレクトさせて、各項目の区切りをカンマにし、"Session Type"の列を除けてしまえば、utuser -af でインポートできるファイルの形にできるかと思います。

トークン情報の削除

トークン情報の削除は以下のコマンドで出来るようです。

# /opt/SUNWut/sbin/utuser -d トークンID

一気に削除する場合はトークンIDを列挙したファイルを用意し、以下コマンドを走らせます。

# /opt/SUNWut/sbin/utuser -df 削除対象トークンIDを列挙したファイル

他にも utuser の使用例を見てみると色々できるようです。

usage:

utuser -l

- list all users

utuser -li

- list all users with token ID's that contain substring

utuser -ln

- list all users with names that contain substring

utuser -lc

- list all users that are currently logged in

utuser -G

- list all users that are currently logged in and the servers they are logged into

utuser -L

- list all users (long format)

utuser -Li

- list all users with token ID's that contain substring

(long format)

utuser -Ln

- list all users with names that contain substring

(long format)

utuser -Lc

- list all users that are currently logged in (long format)

utuser -Ls

- list all users with session type assigned to their token,

being either default, kiosk or regular (long format)

utuser -o

- dump users list in comma-delimited format

utuser -p

- show user properties for user with token

utuser -a ", , , , "

[-r ]

- add a user with the specified properties

(All values except "token_id" and "name" are optional,

although comma separators are required, e.g. ",,,,")

utuser -af [-r ]

- batch add multiple users using input from comma-delimited

format file

utuser -e ", , , , "

- edit the properties for user with token

(All values except "token_id" and "name" are optional,

although comma separators are required, e.g. ",,,,")

utuser -ef

- batch edit multiple users using input from comma-delimited

format file

utuser -d

- delete user with token

utuser -df

- batch delete multiple users using input from comma-delimited

format file

utuser -ai [-r ]

- add additional token to user that currently

has token

utuser -di

- delete token from user that currently has it

utuser -ei enable

utuser -ei disable

- enable/disable a token

utuser -r

- read a token ID from a token reader

utuser -h

- show usage information (this message)

utuser -N

- This option is reserved for internal use

utuser -x

- This option is reserved for internal use