-
Notifications
You must be signed in to change notification settings - Fork 767
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
Request for "ssh-copy-id" #2301
Comments
ssh-copy-id is a POSIX shell script that uses SSH to login to the far side, where it expects to find another POSIX (i.e., ksh-style) shell, to execute there a command line along the lines of Are you looking for a port of that shell script onto cmd.exe or Powershell? What shell will your destination host (far side) run? A POSIX shell, cmd.exe or PowerShell? |
No, I'm not looking for any port. As of know I'm manually copying the pub key to target machine. It would would be nice if ssh-copy-id is also present in windows. it would be great if we have ssh-copy-id script that could identify target machine type and execute the commands accordingly. |
There are currently at least four different commonly used families of shell that you might encounter at the other end of an SSH connection: ksh/bash/zsh/busybox (POSIX), csh/tcsh, cmd.exe and PowerShell. Coming up with well-tested strategies for reliably and efficiently testing which one it is would be an interesting little project. But in such a diverse environment, it might be better (faster, more robust, more portable) to try and do this via the SFTP tool and protocol, instead of via sending shell commands to some unknown type of shell at the other end. Something along the lines of
might be all you need. (Note that this overwrites authorized_keys rather than appending to it.) Perhaps the sftp tool should be extended with an “append” command that works similar to “put” but opens the remote file in append mode (probably using the already proposed SSH_FXF_APPEND_DATA_ATOMIC flag)? Or perhaps sshd should check in future also for an |
A common use case for Googling about revealed this approach in a few places:
I think that technique worked fine, initially, but later versions of Powershell will complain that
The client's public key is actually appended to the After waaaaay too much trial-and-error, the command below seems to work on hosts with a recent version of Powershell:
I post it here mostly so I can find it again, but also it may be generally useful for users of this project. |
It may be worth mentioning that if all cipherswami is trying to do is get their public key into |
Summary of the new feature / enhancement
In UNIX like Operating systems we have ssh-copy-id tool to copy our pub key to target machine, which is missing in windows environment.
Proposed technical implementation details (optional)
Addition of ssh-copy-id tool to Win32-Openssh would be great.
The text was updated successfully, but these errors were encountered: