Debian 6のadduserとuseradd

Debian環境で、ユーザーを登録する時、adduserとuseraddで挙動が異なるので注意。

▼useradd
 ユーザー登録しか行わない。
 -mオプションを指定しないと、ホームディレクトリも作成されないので注意。
 デフォルトのシェルが/bin/sh。コマンド履歴の機能など、bashが提供する機能が使えないので注意。-sオプションで、bashシェルなどを利用するようにすればもちろん別だが。

▼adduser
 以下のようにパスワードの設定などをユーザー登録時に行うことができる。

root@debian:~# adduser user4
Adding user `user4' ...
Adding new group `user4' (1005) ...
Adding new user `user4' (1005) with group `user4' ...
Creating home directory `/home/user4' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for user4
Enter the new value, or press ENTER for the default
Full Name : tanaka
Room Number
: 401
Work Phone :
Home Phone
:
Other []:
Is the information correct? [Y/n] y

 なお、こちらで登録すると、デフォルトのシェルは/bin/bashに。