怎样在win2000 server下用程序添加用户,并将某个指定的目录读取权限交给该用户。(100分)

  • 主题发起人 主题发起人 fxb
  • 开始时间 开始时间
F

fxb

Unregistered / Unconfirmed
GUEST, unregistred user!
怎样在win2000 server下用程序添加用户,并将某个指定的目录读取权限交给该用户。<br>我看到有个程序就是这样做的,不知道如何实现
 
NetUserAdd这个好像可以。我要试试。<br>权限应该更应该行。试试先。等会贴码子。
 
NetUserAdd是什么?API?
 
查查MSDN啊,你。呵呵
 
很详细,我没做过。我也在学啊。
 
直接执行命令<br>NET USER username password ADD &nbsp;<br>,(windows命令),然后改变所加用户的组就改变了权限,<br>因为给组赋予了权限,以上的命令具体用法你可以在windows帮助中查<br>delphi下用类似shellExec()的函数(具体函数名忘了)<br>
 
因该在system32下有个数据库放用户的
 
怎样实现呢?
 
winexec('net user 用戶名﹐密碼 /add',0);增加用戶<br>winexec('net user 用戶名,密碼 /delete',0); 刪除用戶<br>關于net的用法﹐查一下winnt下的幫助
 
那用程序怎样指定某个目录的权限归某个用户呢?
 
注册表查不到应该在系统数据库中吧?
 
用 net share 命令
 
netuseradd,是个api函数,在msdn里查得到的<br>NET_API_STATUS NetUserAdd(<br>&nbsp; LPWSTR servername, <br>&nbsp; DWORD level, &nbsp; &nbsp; &nbsp; <br>&nbsp; LPBYTE buf, &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; LPDWORD parm_err &nbsp; <br>);<br>&nbsp;<br>Parameters<br>servername <br>Pointer to a Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local computer. <br>level <br>Specifies one of the following values to set the level of information provided. Value Meaning <br>1 The buf parameter points to a USER_INFO_1 structure. <br>2 The buf parameter points to a USER_INFO_2 structure. <br>3 The buf parameter points to a USER_INFO_3 structure. <br><br><br>buf <br>Pointer to the buffer in which the data set with the level parameter is stored. <br>parm_err <br>Optional pointer to a DWORD that contains the index of the first parameter that causes ERROR_INVALID_PARAMETER. If NULL, the parameter is not returned on error. <br>在msdn里有更详细的帮助<br>
 
Cacls.exe &nbsp;/* 必须为ntfs才支持 */<br><br>显示或修改文件的访问控制列表 (ACL)。 <br><br>cacls filename [/t] [/e] [/c] [/g user:perm] [/r user [...]] [/p user:perm [...]] [/d user [...]]<br><br>参数 <br><br>filename<br><br>显示指定文件的 ACL。<br><br>/t<br><br>更改当前目录和所有子目录中指定文件的 ACL。<br><br>/e<br><br>编辑 ACL 而不是替换它。<br><br>/c<br><br>忽略错误,继续修改 ACL。<br><br>/g user:per<br><br>授予指定用户访问权限。Perm 可以是: <br><br>n 无 <br><br>r 读取<br><br>c 更改(写入)<br><br>f 完全控制<br><br>/r user<br><br>吊销指定用户访问权限。<br><br>/p user:perm<br><br>替换指定用户的访问权限。Perm 可以是: <br><br>n 无 <br><br>r 读取<br><br>c 更改(写入)<br><br>f 完全控制<br><br>/d user<br><br>拒绝指定的用户访问。<br><br>在一个命令中可以指定多个文件或用户。 <br>
 
后退
顶部