有s权限 用户可以自己修改密码
[root@localhost~17:02:16]# ll /usr/bin/passwd
-rwsr-xr-x. 1 root root 27856 Apr 12020/usr/bin/passwd
[root@localhost~17:03:09]#
[jack01@localhost~17:07:01]$ passwd
Changing password foruser jack01.
Changing password for jack01.
(current) UNIX password:
New password:
BAD PASSWORD: The password is a palindrome
New password:
BAD PASSWORD: The password is a palindrome
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[jack01@localhost~17:07:30]$
没有s权限,用户不能修改密码
[root@localhost ~17:03:09]# chmod u-s /usr/bin/passwd
[root@localhost ~17:08:42]# ll /usr/bin/passwd
-rwxr-xr-x. 1 root root 27856 Apr 12020 /usr/bin/passwd
[root@localhost ~17:08:48]#
[jack01@localhost ~17:07:30]$ passwd
Changing password for user jack01.
Changing password for jack01.
(current) UNIX password:
New password:
Retype new password:passwd: Authentication token manipulation error
[jack01@localhost ~17:09:50]$
sgid演示
创建文件夹77
创建组 afei
将77文件夹的组改为afei
[root@localhost /opt17:24:44]# mkdir 77
[root@localhost /opt17:24:54]# ll
total 0
drwxr-xr-x. 2 root root 6 Mar 1717:2477
[root@localhost /opt17:24:56]# chmod 770 77
[root@localhost /opt17:25:19]# ll
total 0
drwxrwx---. 2 root root 6 Mar 1717:2477
[root@localhost /opt17:25:21]# groupadd 666
groupadd: '666'isnot a valid group name
[root@localhost /opt17:26:31]# groupadd afei
[root@localhost /opt17:26:38]# chgrp afei /opt/77
[root@localhost /opt17:26:57]# ll
total 0
drwxrwx---. 2 root afei 6 Mar 1717:2477
[root@localhost /opt17:26:59]#
还没改77的文件夹组共享的
[root@localhost /opt/7717:27:26]# mkdir 66
[root@localhost /opt/7717:27:36]# ll
total 0
drwxr-xr-x. 2 root root 6 Mar 1717:2766
[root@localhost /opt/7717:27:37]#
将77文件夹属组共享
[root@localhost /opt/7717:27:37]# chmod g+s /opt/77
[root@localhost /opt/7717:28:25]# ll /opt
total 0
drwxrws---. 3 root afei 16 Mar 1717:2777
然后创建了88.txt文件和33文件夹
发现都属于同一个组
[root@localhost /opt/7717:28:38]#
[root@localhost /opt/7717:28:38]# touch 88.txt
[root@localhost /opt/7717:29:12]# mkdir 33
[root@localhost /opt/7717:29:19]# ll
total 0
drwxr-sr-x. 2 root afei 6 Mar 1717:2933
drwxr-xr-x. 2 root root 6 Mar 1717:2766
-rw-r--r--. 1 root afei 0 Mar 1717:2988.txt
[root@localhost /opt/7717:29:22]#
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?