Documentation
¶
Overview ¶
Package nfs implements a server to serve a VFS remote over NFSv3 protocol
There is no authentication available on this server and it is served on loopback interface by default.
This is primarily used for mounting a VFS remote in macOS, where FUSE-mounting mechanisms are usually not available.
Index ¶
- Variables
- func AddFlags(flagSet *pflag.FlagSet, Opt *Options)
- func NewBackendAuthHandler(vfs *vfs.VFS) nfs.Handler
- func Run(command *cobra.Command, args []string)
- type BackendAuthHandler
- func (h *BackendAuthHandler) Change(fs billy.Filesystem) billy.Change
- func (h *BackendAuthHandler) FSStat(ctx context.Context, f billy.Filesystem, s *nfs.FSStat) error
- func (h *BackendAuthHandler) FromHandle([]byte) (billy.Filesystem, []string, error)
- func (h *BackendAuthHandler) HandleLimit() int
- func (h *BackendAuthHandler) Mount(ctx context.Context, conn net.Conn, req nfs.MountRequest) (status nfs.MountStatus, hndl billy.Filesystem, auths []nfs.AuthFlavor)
- func (h *BackendAuthHandler) ToHandle(f billy.Filesystem, s []string) []byte
- type FS
- func (f *FS) Capabilities() billy.Capability
- func (f *FS) Chmod(name string, mode os.FileMode) error
- func (f *FS) Chown(name string, uid, gid int) error
- func (f *FS) Chroot(path string) (billy.Filesystem, error)
- func (f *FS) Chtimes(name string, atime time.Time, mtime time.Time) error
- func (f *FS) Create(filename string) (billy.File, error)
- func (f *FS) Join(elem ...string) string
- func (f *FS) Lchown(name string, uid, gid int) error
- func (f *FS) Lstat(filename string) (os.FileInfo, error)
- func (f *FS) MkdirAll(filename string, perm os.FileMode) error
- func (f *FS) Open(filename string) (billy.File, error)
- func (f *FS) OpenFile(filename string, flag int, perm os.FileMode) (billy.File, error)
- func (f *FS) ReadDir(path string) (dir []os.FileInfo, err error)
- func (f *FS) Readlink(link string) (string, error)
- func (f *FS) Remove(filename string) error
- func (f *FS) Rename(oldpath, newpath string) error
- func (f *FS) Root() string
- func (f *FS) Stat(filename string) (os.FileInfo, error)
- func (f *FS) Symlink(target, link string) error
- func (f *FS) TempFile(dir, prefix string) (billy.File, error)
- type Options
- type Server
Constants ¶
This section is empty.
Variables ¶
var Command = &cobra.Command{ Use: "nfs remote:path", Short: `Serve the remote as an NFS mount`, Long: `Create an NFS server that serves the given remote over the network. The primary purpose for this command is to enable [mount command](/commands/rclone_mount/) on recent macOS versions where installing FUSE is very cumbersome. Since this is running on NFSv3, no authentication method is available. Any client will be able to access the data. To limit access, you can use serve NFS on loopback address and rely on secure tunnels (such as SSH). For this reason, by default, a random TCP port is chosen and loopback interface is used for the listening address; meaning that it is only available to the local machine. If you want other machines to access the NFS mount over local network, you need to specify the listening address and port using ` + "`--addr`" + ` flag. Modifying files through NFS protocol requires VFS caching. Usually you will need to specify ` + "`--vfs-cache-mode`" + ` in order to be able to write to the mountpoint (full is recommended). If you don't specify VFS cache mode, the mount will be read-only. To serve NFS over the network use following command: rclone serve nfs remote: --addr 0.0.0.0:$PORT --vfs-cache-mode=full We specify a specific port that we can use in the mount command: To mount the server under Linux/macOS, use the following command: mount -oport=$PORT,mountport=$PORT $HOSTNAME: path/to/mountpoint Where ` + "`$PORT`" + ` is the same port number we used in the serve nfs command. This feature is only available on Unix platforms. ` + vfs.Help, Annotations: map[string]string{ "versionIntroduced": "v1.65", "groups": "Filter", "status": "Experimental", }, Run: Run, }
Command is the definition of the command
Functions ¶
func NewBackendAuthHandler ¶
NewBackendAuthHandler creates a handler for the provided filesystem
Types ¶
type BackendAuthHandler ¶
type BackendAuthHandler struct {
// contains filtered or unexported fields
}
BackendAuthHandler returns a NFS backing that exposes a given file system in response to all mount requests.
func (*BackendAuthHandler) Change ¶
func (h *BackendAuthHandler) Change(fs billy.Filesystem) billy.Change
Change provides an interface for updating file attributes.
func (*BackendAuthHandler) FSStat ¶
func (h *BackendAuthHandler) FSStat(ctx context.Context, f billy.Filesystem, s *nfs.FSStat) error
FSStat provides information about a filesystem.
func (*BackendAuthHandler) FromHandle ¶
func (h *BackendAuthHandler) FromHandle([]byte) (billy.Filesystem, []string, error)
FromHandle handled by CachingHandler
func (*BackendAuthHandler) HandleLimit ¶
func (h *BackendAuthHandler) HandleLimit() int
HandleLimit handled by cachingHandler
func (*BackendAuthHandler) Mount ¶
func (h *BackendAuthHandler) Mount(ctx context.Context, conn net.Conn, req nfs.MountRequest) (status nfs.MountStatus, hndl billy.Filesystem, auths []nfs.AuthFlavor)
Mount backs Mount RPC Requests, allowing for access control policies.
func (*BackendAuthHandler) ToHandle ¶
func (h *BackendAuthHandler) ToHandle(f billy.Filesystem, s []string) []byte
ToHandle handled by CachingHandler
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
FS is our wrapper around the VFS to properly support billy.Filesystem interface
func (*FS) Capabilities ¶
func (f *FS) Capabilities() billy.Capability
Capabilities exports the filesystem capabilities
func (*FS) Chroot ¶
func (f *FS) Chroot(path string) (billy.Filesystem, error)
Chroot is not supported in VFS
func (*FS) MkdirAll ¶
MkdirAll creates a directory and all the ones above it it does not redirect to VFS.MkDirAll because that one doesn't honor the permissions
type Options ¶
type Options struct {
ListenAddr string // Port to listen on
}
Options contains options for the NFS Server