C Shell Wiki
Posts (Latest 10 updated) :
Read all
Contents:
  1. [Unix系] C Shell (csh) usermod の使い方: ユーザーアカウントの変更
    1. Overview
    2. Usage
    3. Common Options
    4. Common Examples
      1. ユーザー名の変更
      2. ホームディレクトリの変更
      3. シェルの変更
      4. グループの追加
    5. Tips

[Unix系] C Shell (csh) usermod の使い方: ユーザーアカウントの変更

Overview

usermodコマンドは、既存のユーザーアカウントの属性を変更するために使用されます。このコマンドを使用することで、ユーザー名、ホームディレクトリ、シェルなどの設定を変更できます。

Usage

基本的な構文は以下の通りです。

usermod [options] [arguments]

Common Options

  • -l <新しいユーザー名>: ユーザー名を変更します。
  • -d <新しいホームディレクトリ>: ホームディレクトリを変更します。
  • -s <新しいシェル>: ユーザーのログインシェルを変更します。
  • -G <グループ>: ユーザーを新しいグループに追加します。

Common Examples

以下は、usermodコマンドの実用的な例です。

ユーザー名の変更

usermod -l newusername oldusername

ホームディレクトリの変更

usermod -d /new/home/directory username

シェルの変更

usermod -s /bin/zsh username

グループの追加

usermod -G groupname username

Tips

  • usermodコマンドを実行するには、通常管理者権限が必要です。sudoを使用して実行することをお勧めします。
  • 変更後は、ユーザーが新しい設定で正しくログインできるか確認してください。
  • 変更内容を適用するために、ユーザーが再ログインする必要がある場合があります。