doujia2021 2019-07-09 16:54
浏览 65

使用Go从Kubernetes连接到Windows共享驱动器

I need to connect to windows remote server(shared drive) from GO API hosted in the alpine linux. I tried using tcp,ssh and ftp none of them didn't work. Any suggestions or ideas to tackle this?

  • 写回答

2条回答 默认 最新

  • douwei2713 2019-07-09 22:02
    关注

    Windows shares use the SMB protocol. There are a couple of Go libraries for using SMB, but I have never used them so I cannot vouch for their utility. Here is one I Googled:

    https://github.com/stacktitan/smb

    Other options would be to ensure that the Windows share is mounted on the Linux host filesystem using cifs. Then you could just use the regular Go file utilities:

    https://www.thomas-krenn.com/en/wiki/Mounting_a_Windows_Share_in_Linux

    Or, you could install something like Cygwin on the Windows box and run an SSH server. This would allow you to use SCP:

    https://godoc.org/github.com/tmc/scp

    评论

报告相同问题?