[Libguestfs] [INCOMPLETE PATCH nbdkit] ssh: Allow the remote file to be created

Richard W.M. Jones rjones at redhat.com
Fri Apr 15 11:46:24 UTC 2022


This patch is incomplete (missing tests) so for discussion only, but
it implements nbdkit-ssh-plugin create=true option which creates the
remote file.

Example:

$ nbdkit ssh host=foo /var/tmp/newdisk create=true create-size=100M
$ nbdsh -u nbd://localhost

The disk is only created on first connection (which works the same way
as nbdkit-vddk-plugin).  So if you just want to create the remote disk
and not do anything else, you should do something like this:

nbdkit -U - ssh host=foo /var/tmp/newdisk create=true create-size=100M \
       --run 'nbdinfo --can connect $uri'

If the remote disk already exists, it is truncated but not recreated
(in this case you'll notice the remote ctime is not touched).

For some reason I don't understand, create-mode=0777 is ineffective.
sftp-server has a -u option to set the umask, or else it uses the
remote user's umask.  I verified that openssh does *not* use the -u
option and that the umask of sftp-server is 0002, yet the permissions
on the file are still 0700.

Rich.




More information about the Libguestfs mailing list