2008-12-09 74 views

回答

1

使用passwd shell命令。

+0

不密码块重定向输入?如果没有,你可以这样做,但是你必须把所有三行写到一个文件(原始的,新的,新的),然后重定向它,但我认为这不应该工作(为了安全) 。可能是错的。 – 2008-12-09 18:39:12

1

苹果推出Mac OS中10.5 CSIdentitySetPassword API,允许更改密码,如下所示:

#import <Collaboration/Collaboration.h> 

    AuthorizationRef authRef = NULL; // You have to initialize authRef 

    CBIdentityAuthority *authority = [CBIdentityAuthority defaultIdentityAuthority]; 
    CSIdentityRef identity = [CBIdentity identityWithName:user authority:authority].CSIdentity; 
    if (CSIdentityGetClass(identity) == kCSIdentityClassUser) { 
     CSIdentitySetPassword(identity, (__bridge CFStringRef)newPassword); 
     CSIdentityCommit(identity, authRef, NULL); 
    } 

AuthenticationRef可以如int this响应进行初始化。

相关问题