dqan70724
2014-06-09 16:24
浏览 480
已采纳

Golang:访问Windows共享(从Linux应用程序)

Is there a proper way to connect to a Windows share, such as \windowspc\c$\myshare, from a Go application that is compiled and running on a Linux device?

The share will require credentials to save a file to the target UNC path.

Is there a best practices to accomplish this?

图片转代码服务由CSDN问答提供 功能建议

是否有正确的方法从Windows连接到Windows共享,例如\ windowspc \ c $ \ myshare 是要在Linux设备上编译并运行的应用程序?

共享将需要凭据才能将文件保存到目标UNC路径。

是 有最佳实践来实现这一目标吗?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doufei8250 2014-06-09 16:32
    已采纳

    Theoretically yes, practically no.

    Windows shares use the SMB/CIFS family of protocols. Those can be implemented in Go and be used to access the shares. This is a huge task, though.

    Instead of having this in your application the best way is to require the share to be mounted from your system and then access it like a local file system from the application.

    If you really want to use SMB/CIFS you can check whether the Gnome VFS (virtual file system) or FUSE as C libraries from within Go, but this will be messy and ugly.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题