-
Couldn't load subscription status.
- Fork 110
Open
Description
We use go-smb2 to do file deliveries to a host of different windows shares.
We recently had a requirement to do deliveries to FSx using the supported smb protocol.
This is authenticated using our local domain.
I am able to initiate a connection to the target server, however if i try and list the shares, i only see the "IPC$" share.
None of the other shares are visible/accessible.
To confirm it was not a auth issue, i connected to the share from command line using smbclient, and that works 100%.
The error we get is {Network Name Not Found} The specified share name cannot be found on the remote server.
See below code:
user := target.User
pass, err := target.Password.GetPassword()
if err != nil {
fmt.Println("Unable to load password: ", err.Error())
return err
}
host := target.Host
port := target.Port
addr := fmt.Sprintf("%s:%d", host, port)
conn, err := net.Dial("tcp", addr)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to connect to [%s]: %v\n", addr, err)
return err
}
defer conn.Close()
d := &smb2.Dialer{
Initiator: &smb2.NTLMInitiator{
User: user,
Password: pass,
Domain: target.Domain,
},
}
s, err := d.Dial(conn)
if err != nil {
fmt.Fprintf(os.Stderr, "Unable connect to server: %v\n", err)
return err
}
defer s.Logoff()
names, err := s.ListSharenames()
if err != nil {
panic(err)
}
fmt.Println("Available shares:")
for _, name := range names {
fmt.Println(name)
}
fmt.Fprintf(os.Stdout, "Mounting share [%s] ...\n", target.Share)
fs, err := s.Mount(target.Share)
if err != nil {
fmt.Fprintf(os.Stderr, "Unable to mount share: %v\n", err)
return err
}
defer fs.Umount()
Metadata
Metadata
Assignees
Labels
No labels