我正在尝试scp
从Bitbucket管道到Windows Server2016。Windows服务器已安装Win32-OpenSSH。
命令输出:
+ scp -v sample.conf john.doe@xx.yyy.zzz.xyz:/C:/Users/john.doe
Executing: program /usr/bin/ssh host xx.yyy.zzz.xyz, user john.doe, command scp -v -d -t /C:/Users/john.doe
OpenSSH_7.7p1, LibreSSL 2.7.4
debug1: Reading configuration data /home/gradle/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to xx.yyy.zzz.xyz [xx.yyy.zzz.xyz] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/gradle/.ssh/id_pipelines type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/gradle/.ssh/id_pipelines-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.7
debug1: Remote protocol version 2.0, remote software version OpenSSH_for_Windows_7.7
debug1: match: OpenSSH_for_Windows_7.7 pat OpenSSH* compat 0x04000000
debug1: Authenticating to xx.yyy.zzz.xyz:22 as 'john.doe'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:wkXf3e9jgd5W/QY/LwBF41XgeJIC/wLZBeavZI/xYM
debug1: Host 'xx.yyy.zzz.xyz' is known and matches the RSA host key.
debug1: Found key in /home/gradle/.ssh/known_hosts:3
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /home/gradle/.ssh/id_pipelines
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: Authentications that can continue: publickey,password,keyboard-interactive
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: Authentications that can continue: publickey,password,keyboard-interactive
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: No more authentication methods to try.
john.doe@xx.yyy.zzz.xyz: Permission denied (publickey,password,keyboard-interactive).
lost connection
中未注释的行 C:\ProgramData\ssh\sshd_config
Port 22
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication yes
PermitEmptyPasswords no
Subsystem sftp sftp-server.exe
在Windows服务器上,公钥位于 C:\Users\john.doe\.ssh\authorized_keys
我只是不确定配置有什么问题。任何想法?
scp
使用两个帐户(我的帐户和一个构建用户的帐户)。由于我可以使用这两个帐户中的任何一个进行远程登录,并且都具有Windows服务器上的管理员权限,因此authorized_keys
在进行故障排除时,我意外地最终使用了构建用户的帐户来修改我的文件。从来没有想过我会在Windows上弄乱这样的事情。现在,我意识到就Windows而言,权限问题SSH
至关重要。感谢您粘贴w32-sshfileperm.c
文件Marcelo中的注释!那真的有帮助。:)