将用户添加到组,但在运行"id"时未反映 [英] Add user to group but not reflected when run "id"
问题描述
R创建了一个名为staff的组,我希望能够在不以sudo身份启动R的情况下更新软件包.因此,我使用以下方法将自己添加到了员工中:
R creates a group called staff and I want to be able to update packages without starting R as sudo. So I added myself to staff using:
sudo usermod -G adm,dialout,cdrom,plugdev,lpadmin,admin,sambashare,staff matt
(旁边的问题有没有一种方法可以将您自己添加到一个组中,而无需列出您所属的其他每个组?)
(side question is there a way to add yourself to a group without listing every other group you're a member of?)
如果我查看/etc/groups,我会看到
If i check /etc/groups i see
staff:x:50:matt
和/etc/shadow相同
and the same for /etc/shadow
staff:*::matt
但是,如果我运行小组或ID,则我不是工作人员.另外,我无法对/usr/local/lib/R中的任何内容进行更改.
however if i run groups or id i'm not a member of staff. Also, I can't make changes to anything in /usr/local/lib/R.
推荐答案
运行sudo usermod
命令后,您是否注销了"matt"帐户并重新登录?对用户在Unix下所在的组所做的更改仅在登录时生效.
Did you log the "matt" account out and back in after running the sudo usermod
command? Changes to the groups a user is in under unix only take affect at login time.
这篇关于将用户添加到组,但在运行"id"时未反映的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!