免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1359 | 回复: 4
打印 上一主题 下一主题

[系统安装] 我是新手,如何将用户添加的某个组 [复制链接]

论坛徽章:
223
2022北京冬奥会纪念版徽章
日期:2015-08-10 16:30:32操作系统版块每日发帖之星
日期:2016-05-10 19:22:58操作系统版块每日发帖之星
日期:2016-02-18 06:20:00操作系统版块每日发帖之星
日期:2016-03-01 06:20:00操作系统版块每日发帖之星
日期:2016-03-02 06:20:0015-16赛季CBA联赛之上海
日期:2019-09-20 12:29:3219周年集字徽章-周
日期:2019-10-01 20:47:4815-16赛季CBA联赛之八一
日期:2020-10-23 18:30:5320周年集字徽章-20	
日期:2020-10-28 14:14:2615-16赛季CBA联赛之广夏
日期:2023-02-25 16:26:26CU十四周年纪念徽章
日期:2023-04-13 12:23:10操作系统版块每日发帖之星
日期:2016-05-10 19:22:58
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2016-07-04 09:18 |只看该作者 |倒序浏览
以前gnome全是图形操作的,现在xfce取消了用户管理

想把当前用户shell添加到系统分组里面,比如www-data, kvm等等

论坛徽章:
223
2022北京冬奥会纪念版徽章
日期:2015-08-10 16:30:32操作系统版块每日发帖之星
日期:2016-05-10 19:22:58操作系统版块每日发帖之星
日期:2016-02-18 06:20:00操作系统版块每日发帖之星
日期:2016-03-01 06:20:00操作系统版块每日发帖之星
日期:2016-03-02 06:20:0015-16赛季CBA联赛之上海
日期:2019-09-20 12:29:3219周年集字徽章-周
日期:2019-10-01 20:47:4815-16赛季CBA联赛之八一
日期:2020-10-23 18:30:5320周年集字徽章-20	
日期:2020-10-28 14:14:2615-16赛季CBA联赛之广夏
日期:2023-02-25 16:26:26CU十四周年纪念徽章
日期:2023-04-13 12:23:10操作系统版块每日发帖之星
日期:2016-05-10 19:22:58
2 [报告]
发表于 2016-07-04 09:50 |只看该作者
估计只有这个才行
  1. shell@localhost:~$ /usr/sbin/usermod -h
  2. Usage: usermod [options] LOGIN

  3. Options:
  4.   -c, --comment COMMENT         new value of the GECOS field
  5.   -d, --home HOME_DIR           new home directory for the user account
  6.   -e, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
  7.   -f, --inactive INACTIVE       set password inactive after expiration
  8.                                 to INACTIVE
  9.   -g, --gid GROUP               force use GROUP as new primary group
  10.   -G, --groups GROUPS           new list of supplementary GROUPS
  11.   -a, --append                  append the user to the supplemental GROUPS
  12.                                 mentioned by the -G option without removing
  13.                                 him/her from other groups
  14.   -h, --help                    display this help message and exit
  15.   -l, --login NEW_LOGIN         new value of the login name
  16.   -L, --lock                    lock the user account
  17.   -m, --move-home               move contents of the home directory to the
  18.                                 new location (use only with -d)
  19.   -o, --non-unique              allow using duplicate (non-unique) UID
  20.   -p, --password PASSWORD       use encrypted password for the new password
  21.   -R, --root CHROOT_DIR         directory to chroot into
  22.   -s, --shell SHELL             new login shell for the user account
  23.   -u, --uid UID                 new UID for the user account
  24.   -U, --unlock                  unlock the user account
  25.   -v, --add-subuids FIRST-LAST  add range of subordinate uids
  26.   -V, --del-subuids FIRST-LAST  remove range of subordinate uids
  27.   -w, --add-subgids FIRST-LAST  add range of subordinate gids
  28.   -W, --del-subgids FIRST-LAST  remove range of subordinate gids
  29.   -Z, --selinux-user SEUSER     new SELinux user mapping for the user account

  30. shell@localhost:~$
  31. shell@localhost:~$
复制代码

论坛徽章:
223
2022北京冬奥会纪念版徽章
日期:2015-08-10 16:30:32操作系统版块每日发帖之星
日期:2016-05-10 19:22:58操作系统版块每日发帖之星
日期:2016-02-18 06:20:00操作系统版块每日发帖之星
日期:2016-03-01 06:20:00操作系统版块每日发帖之星
日期:2016-03-02 06:20:0015-16赛季CBA联赛之上海
日期:2019-09-20 12:29:3219周年集字徽章-周
日期:2019-10-01 20:47:4815-16赛季CBA联赛之八一
日期:2020-10-23 18:30:5320周年集字徽章-20	
日期:2020-10-28 14:14:2615-16赛季CBA联赛之广夏
日期:2023-02-25 16:26:26CU十四周年纪念徽章
日期:2023-04-13 12:23:10操作系统版块每日发帖之星
日期:2016-05-10 19:22:58
3 [报告]
发表于 2016-07-04 09:59 |只看该作者
  1. shell@localhost:~$ man usermod
  2. shell@localhost:~$ su -
  3. Password:
  4. root@localhost:~#
  5. root@localhost:~#
  6. root@localhost:~# id shell
  7. uid=1000(shell) gid=1000(shell) groups=1000(shell),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),108(netdev),111(scanner),116(bluetooth),123(lpadmin)
  8. root@localhost:~#
  9. root@localhost:~# usermod -h
  10. Usage: usermod [options] LOGIN

  11. Options:
  12.   -c, --comment COMMENT         new value of the GECOS field
  13.   -d, --home HOME_DIR           new home directory for the user account
  14.   -e, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
  15.   -f, --inactive INACTIVE       set password inactive after expiration
  16.                                 to INACTIVE
  17.   -g, --gid GROUP               force use GROUP as new primary group
  18.   -G, --groups GROUPS           new list of supplementary GROUPS
  19.   -a, --append                  append the user to the supplemental GROUPS
  20.                                 mentioned by the -G option without removing
  21.                                 him/her from other groups
  22.   -h, --help                    display this help message and exit
  23.   -l, --login NEW_LOGIN         new value of the login name
  24.   -L, --lock                    lock the user account
  25.   -m, --move-home               move contents of the home directory to the
  26.                                 new location (use only with -d)
  27.   -o, --non-unique              allow using duplicate (non-unique) UID
  28.   -p, --password PASSWORD       use encrypted password for the new password
  29.   -R, --root CHROOT_DIR         directory to chroot into
  30.   -s, --shell SHELL             new login shell for the user account
  31.   -u, --uid UID                 new UID for the user account
  32.   -U, --unlock                  unlock the user account
  33.   -v, --add-subuids FIRST-LAST  add range of subordinate uids
  34.   -V, --del-subuids FIRST-LAST  remove range of subordinate uids
  35.   -w, --add-subgids FIRST-LAST  add range of subordinate gids
  36.   -W, --del-subgids FIRST-LAST  remove range of subordinate gids
  37.   -Z, --selinux-user SEUSER     new SELinux user mapping for the user account

  38. root@localhost:~#
  39. root@localhost:~# usermod shell -aG 127,128,129
  40. root@localhost:~# id shell
  41. uid=1000(shell) gid=1000(shell) groups=1000(shell),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),108(netdev),111(scanner),116(bluetooth),123(lpadmin),127(kvm),128(libvirt),129(libvirt-qemu)
  42. root@localhost:~#
复制代码
成功

论坛徽章:
223
2022北京冬奥会纪念版徽章
日期:2015-08-10 16:30:32操作系统版块每日发帖之星
日期:2016-05-10 19:22:58操作系统版块每日发帖之星
日期:2016-02-18 06:20:00操作系统版块每日发帖之星
日期:2016-03-01 06:20:00操作系统版块每日发帖之星
日期:2016-03-02 06:20:0015-16赛季CBA联赛之上海
日期:2019-09-20 12:29:3219周年集字徽章-周
日期:2019-10-01 20:47:4815-16赛季CBA联赛之八一
日期:2020-10-23 18:30:5320周年集字徽章-20	
日期:2020-10-28 14:14:2615-16赛季CBA联赛之广夏
日期:2023-02-25 16:26:26CU十四周年纪念徽章
日期:2023-04-13 12:23:10操作系统版块每日发帖之星
日期:2016-05-10 19:22:58
4 [报告]
发表于 2016-07-04 10:03 |只看该作者
kvm终于不用输入密码了,这下也是方便多了
  1. shell@localhost:~$ ps aux |grep virt
  2. root       464  0.0  0.8 1056876 32208 ?       Ssl  09:00   0:01 /usr/sbin/libvirtd
  3. shell     3725  1.6  1.8 1010244 68108 ?       Ssl  10:01   0:01 /usr/bin/python2 -tt /usr/share/virt-manager/virt-manager
  4. shell     3764  0.0  0.0  12748  2236 pts/0    S+   10:03   0:00 grep virt
  5. shell@localhost:~$
  6. shell@localhost:~$
复制代码

论坛徽章:
1
2015年迎新春徽章
日期:2015-03-04 09:57:09
5 [报告]
发表于 2016-07-06 10:14 |只看该作者
>$ sudo usermod -a -G kvm shell
>$ groups shell
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP