免费注册 查看新帖 |

Chinaunix

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

如何分别设置密码过期时间 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-07-22 16:04 |只看该作者 |倒序浏览
已经用了/etc/default/passwd 限制最大密码修改时间为  7weeks

但是其中现在有1个用户需要1个月改1次,另外一个需要密码永久有效,不修改

该怎么设置呢

是修改/etc/shadow里的第8段吗

论坛徽章:
0
2 [报告]
发表于 2009-07-22 16:48 |只看该作者
不用直接编辑吧?那么麻烦?


man passwd

   -n min              Sets minimum field  for  name.  The  min
                         field  contains  the  minimum  number of
                         days between password changes for  name.
                         If min is greater than max, the user can
                         not change the password. Always use this
                         option with the -x option, unless max is
                         set to -1 (aging turned  off).  In  that
                         case, min need not be set.

     -u                  Unlocks  a  locked  password  for  entry
                         name. See the -d option for removing the
                         locked password, or to set a password to
                         allow logins.

     -w warn             Sets warn field for name. The warn field
                         contains  the  number of days before the
                         password expires and the user is warned.
                         This  option  is  not  valid if password
                         aging is disabled.

     -x max              Sets maximum field  for  name.  The  max
                         field  contains  the number of days that
                         the password  is  valid  for  name.  The
                         aging for name is turned off immediately
                         if max is set to -1.


#passwd -w 30 -x 31 user1 用来30天就通知更改。

论坛徽章:
0
3 [报告]
发表于 2009-07-22 16:58 |只看该作者
那那个密码永远不过期的呢,如何设置

论坛徽章:
0
4 [报告]
发表于 2009-07-22 17:19 |只看该作者
设置密码过期时间,以账号aaa为例:
#passwd -x 20 aaa    设置20天过期
设置密码永不过期,以账号aaa为例:
#passwd -x -1 aaa

论坛徽章:
0
5 [报告]
发表于 2009-07-22 17:20 |只看该作者
实际上改的是shadow的第五个字段。

论坛徽章:
0
6 [报告]
发表于 2009-07-23 11:20 |只看该作者
试了下passwd -x -1 aaa 。发现9段里除了前3段其他所有的都置空了

man帮助里说The aging for name will be  turned  off  immediately if max is set to -1

这里的aging做何解?是指密码的过期这种机制吗
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP