简体   繁体   English

如何在NETAPP上获取NTFS

[英]How to get NTFS on NETAPP

Does anyone know how to list NTFS permissions on all shares in a NETAPP vfiler using C#? 有谁知道如何使用C#列出NETAPP vfiler中所有共享的NTFS权限?

I tried to use NETAPP API but only get the share permissions, can't find a way to get the NTFS ones. 我尝试使用NETAPP API,但仅获得共享权限,找不到获取NTFS的方法。

EDIT 编辑

Thanks Sobrique, here's the C# syntax: 感谢Sobrique,这是C#语法:

        var api = new NaElement("system-cli");
        var args = new NaElement("args");
        args.AddNewChild("arg", "fsecurity");
        args.AddNewChild("arg", "show");
        args.AddNewChild("arg", path);
        api.AddChildElement(args);
        s.InvokeElem(api)

For doing this though, I tend to use: 为此,我倾向于使用:

vfiler run vfilername fsecurity show /path/to/file/here

This will print the various ACL attributes (NTFS and Unix) for the file in question. 这将为该文件打印各种ACL属性(NTFS和Unix)。 You'll need to first enumerate your share paths to do this. 为此,您需要首先枚举共享路径。 ( cifs shares is a start point). cifs shares是一个起点)。

There is a way to do it via the API - you need to use the undocumented 'system-cli' function that lets you remote execute commands and capture output. 有一种方法可以通过API进行操作-您需要使用未记录的“ system-cli”功能,该功能可让您远程执行命令并捕获输出。

Unfortunately doing this the output is ... about on a par with just running an ssh command. 不幸的是,这样做的结果与运行ssh命令差不多。

However - craft your XML: 但是,请制作您的XML:

<!DOCTYPE netapp SYSTEM "/na_admin/netapp_filer.dtd">
<netapp version="1.7" xmlns="http://www.netapp.com/filer/admin">
  <system-cli>
    <args>
      <arg>fsecurity</arg>
      <arg>show</arg>
      <arg>/vol/volname/qtreename/sharename/filename</arg>
    </args>
  </system-cli>
</netapp>

This will do the trick, although it will return you plain text cli-output element. 尽管将返回纯文本cli-output元素,但这将达到目的。

use strict;
use warnings;

use XML::Twig;
use LWP;

my $twig = XML::Twig->new( 'pretty_print' => 'indented' );
$twig->set_root(
    XML::Twig::Elt->new(
        'netapp',
        {   version => 1.7,
            vfiler  => "somevfiler",
            xmlns   => "http://www.netapp.com/filer/admin",
        },
    )
);
my $api_req = $twig->root->insert_new_elt('system-cli');
my $args    = $api_req->insert_new_elt('args');
$args->insert_new_elt( 'last_child', 'arg', 'fsecurity' );
$args->insert_new_elt( 'last_child', 'arg', 'show' );
$args->insert_new_elt( 'last_child', 'arg', '/vol/volname/qtree/filename' );

$twig->set_doctype('netapp SYSTEM "file:/etc/netapp_filer.dtd"');
$twig->set_xml_version("1.0");
$twig->set_encoding('utf-8');

$twig->print;

exit;

my $user_agent = LWP::UserAgent->new(
    'ssl_opts' => {
        'verify_hostname' => 0,
        'SSL_version'     => 'SSLv3',
    }
);

my $request =
    HTTP::Request->new( 'POST' =>
        'https://myfilername/servlets/netapp.servlets.admin.XMLrequest_filer'
    );
$request->authorization_basic( 'username_here', 'password_here' );
$request->content( $twig->sprint );

my $results = $user_agent->request($request);
if ( not $results->is_success ) {
    print "Error: ", $results->status_line;
    exit;
}

my $results_xml = XML::Twig->new( 'pretty_print' => 'indented_a' );
$results_xml->parse( $results->content );
$results_xml->print;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM