inux新增使用者(user)到使用者組(group)

2021-06-16 09:10:11 字數 1465 閱讀 8328

將乙個使用者新增到使用者組中,千萬不能直接用: 

usermod -g groupa 

這樣做會使你離開其他使用者組,僅僅做為 這個使用者組 groupa 的成員。 

應該用 加上 -a 選項: 

usermod -a -g groupa user

命令的所有的選項,及其含義: 

options: 

-c, --comment comment         new value of the gecos field 

-d, --home home_dir           new home directory for the user account 

-e, --expiredate expire_date set account expiration date to expire_date 

-f, --inactive inactive       set password inactive after expiration 

to inactive 

-g, --gid group               force use group as new primary group 

-g, --groups groups           new list of supplementary groups 

mentioned by the -g option without removing 

him/her from other groups 

-h, --help                    display this help message and exit 

-l, --login new_login         new value of the login name 

-l, --lock                    lock the user account 

-m, --move-home               move contents of the home directory to the new 

location (use only with -d) 

-o, --non-unique              allow using duplicate (non-unique) uid 

-p, --password password       use encrypted password for the new password 

-s, --shell shell             new login shell for the user account 

-u, --uid uid                 new uid for the user account 

-u, --unlock                  unlock the user account 

檢視使用者所屬的組使用命令:$ groups tmn

inux命令 使用者相關

1.群組 groupadd group name 建立乙個新使用者組 groupdel group name 刪除乙個使用者組 groupmod n new group name old group name 重新命名乙個使用者組 useradd c name surname g admin d h...

新增使用者到 sudo

sudo 簡介 在 linux 中系統管理員可以通過 sudo 實用程式讓使用者或組能夠作為另乙個使用者執行命令。換句話說,可以分派命令特權,而不需要另乙個使用者的密碼。root 使用者通過在 etc sudoers檔案中設定 sudo 條目完成這個過程。使用 visudo 命令編輯此檔案。在分派特...

新增linux使用者到使用者組

將乙個使用者新增到使用者組中,千萬不能直接用 usermod g groupa 這樣做會使你離開其他使用者組,僅僅做為 這個使用者組 groupa 的成員。應該用 加上 a 選項 usermod a g groupa 命令的所有的選項,及其含義 options c,comment comment n...