LoginSignup
26
26

More than 5 years have passed since last update.

/etc/groupを管理するコマンド "gpasswd"

Last updated at Posted at 2013-07-25

admin, mysql, wwwグループに所属しているユーザscottを、hogeグループにも所属させたい場合、

$ usermod -Ghoge scott

とかやってしまうと、ユーザscottはhogeグループに所属するようになるのですが、その代わりadmin, mysql, wwwグループから外れてしまいます。

かといって

$ usermod -Gadmin,mysql,www,hoge scott

とかするのは面倒です。

そんな時にgpasswdコマンドです。

詳細はマニュアルを読んでいただくとして
とりあえずこんな感じでscottをhogeグループに追加します。

$ gpasswd -a scott hoge

で、idコマンドでユーザー情報を確認するとちゃんとhogeグループに追加できました。

$ id scott
uid=1000(scott), gid=1000(scott),groups=1000(scott),10(admin),11(mysql),12(www),13(hoge)
26
26
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
26
26