Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Salt] Replace scp with scp + mv to handle non-root case #7833

Merged
merged 1 commit into from
Jul 11, 2019
Merged

[Salt] Replace scp with scp + mv to handle non-root case #7833

merged 1 commit into from
Jul 11, 2019

Conversation

davidhao3300
Copy link
Contributor

@davidhao3300 davidhao3300 commented Jul 2, 2019

If the SSH user is not privileged, you cannot directly SCP a file/folder to the destination if the destination is inaccessible to the SSH user. The general recommended solution appears to be upload to the user's home directory and then mv with sudo to the final destination.

@davidhao3300 davidhao3300 requested a review from a team as a code owner July 2, 2019 22:09
@SwampDragons
Copy link
Contributor

Doesn't this just move the assumption to be that your user will have access to the parent directory?

@davidhao3300
Copy link
Contributor Author

It assumes that the home directory of the SSH user is modifiable by the user, which I think is an okay assumption

@SwampDragons
Copy link
Contributor

_, temp_dst := filepath.Split(dst) isn't necessarily the homedir; I don't think every dst being passed to uploadFile can be assumed to be of the format ~/myfilename.ext

@davidhao3300
Copy link
Contributor Author

the filePath.split will yield some name that doesn't have a slash in the front. If that's the case, and we scp it, the file should be put in wherever the user ssh's into first, right? like if you scp test.txt without any prefix, it will upload to ~/test.txt

@SwampDragons
Copy link
Contributor

Hm, you're right. Okay, I'll let this through.

@SwampDragons SwampDragons merged commit e229f75 into hashicorp:master Jul 11, 2019
@davidhao3300
Copy link
Contributor Author

Thank you!

@ghost
Copy link

ghost commented Mar 28, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants