禁用编辑全名用户

禁用编辑全名用户

我在学校环境中拥有一些 Ubuntu 14.04 桌面,其中有一个名为“Student”的用户帐户,供学生使用。有些学生会用随机内容替换用户名的全名,这是可能的。是否可以阻止普通用户编辑全名?

答案1

根据man chfn,您应该能够使用CHFN_RESTRICT中的设置来控制对 GECOS 数据字段的访问login.defs

CONFIGURATION
       The following configuration variables in /etc/login.defs change the
       behavior of this tool:

       CHFN_RESTRICT (string)
           This parameter specifies which values in the gecos field of the
           /etc/passwd file may be changed by regular users using the chfn
           program. It can be any combination of letters f, r, w, h, for Full
           name, Room number, Work phone, and Home phone, respectively. For
           backward compatibility, yes is equivalent to rwh and no is
           equivalent to frwh. If not specified, only the superuser can make
           any changes. The most restrictive setting is better achieved by not
           installing chfn SUID.

相关内容