canonical / multipass

Multipass orchestrates virtual Ubuntu instances
https://multipass.run
GNU General Public License v3.0
7.87k stars 651 forks source link

[transfer] permission denied where the `ubuntu` user is lacking write access #1433

Open Saviq opened 4 years ago

Saviq commented 4 years ago

When using multipass transfer, the user on the instance side is ubuntu, meaning an attempt to write somewhere that it doesn't have access to fails with permission errors:

$ mp transfer file primary:/file
transfer failed: [sftp push] open failed: 'SFTP server: Permission denied'

Originally posted by @jasonmccallister in https://github.com/canonical/multipass/issues/1165#issuecomment-600307143

townsend2010 commented 4 years ago

Hmm, what are we supposed to do here? Give full access to any part of the filesystem for the ubuntu user? Regular sftp/scp also denies permission when the user can't access a particular part of the filesystem.

Saviq commented 4 years ago

My first inclination is that it should do the same that multipass mount does - create the missing section of the path, making ubuntu the owner. JFDI of sorts. That said, I think we're missing the case when part of the existing path is not accessible to ubuntu. I.e. /root - but that may be a slightly different error - if the ubuntu user can access the whole existing section, we would just mkdir -p the remainder.

townsend2010 commented 4 years ago

I think this bug is just about the ubuntu user not having permission somewhere in the given remote path, such as /root as you say. We are using the security of ssh_server here, so I think the user should modify the ssh server's config to allow different permissions and multipass shouldn't do that.

I really don't think there is anything for us to do with this bug and should be closed.