NfsClient icon indicating copy to clipboard operation
NfsClient copied to clipboard

how to list other dir?

Open xingfengf21 opened this issue 2 years ago • 0 comments

this is my fucking code

portmap initialization

portmap = Portmap(host, timeout=3600) print(portmap.connect())

mount initialization

mnt_port = portmap.getport(Mount.program, Mount.program_version) mount = Mount(host=host, port=mnt_port, timeout=3600, auth=auth) mount.connect()

do mount

mnt_res =mount.mnt(mount_path, auth=auth)

if mnt_res["status"] == MNT3_OK: root_fh =mnt_res["mountinfo"]["fhandle"]

print('root_fh',root_fh, type(root_fh))
try:
    nfs_port =portmap.getport(NFS_PROGRAM, NFS_V3)
    # nfs actions
    nfs3 =NFSv3(host, nfs_port, 3600, auth=auth)
    nfs3.connect()
    lookup_res = nfs3.readdirplus(root_fh+b'/a',auth=auth) #
    print(lookup_res)
except Exception as e:
    print(e)
finally:
    if nfs3:
        nfs3.disconnect()
    # mount.umnt(mount_path)
    mount.disconnect()
    portmap.disconnect()

else: mount.disconnect() portmap.disconnect()

xingfengf21 avatar Apr 15 '22 07:04 xingfengf21