OpenSSH가 ssh_config에 지정된 사용자를 사용하지 않는 이유는 무엇입니까?

OpenSSH가 ssh_config에 지정된 사용자를 사용하지 않는 이유는 무엇입니까?

저는 Windows 시스템에서 OpenSSH를 사용하여 Linux Mint 9 상자에 연결하고 있습니다. 내 Windows 사용자 이름이 ssh 대상의 사용자 이름과 일치하지 않아서 를 사용하여 로그인에 사용할 사용자를 지정하려고 합니다 ssh_config. ssh_config나는 식별 파일을 지정했기 때문에 OpenSSH가 파일을 볼 수 있다는 것을 알고 있습니다 .

ssh_config의 호스트 관련 섹션은 다음과 같습니다.

  Host hostname
    HostName      hostname
    IdentityFile  ~/.ssh/id_dsa
    User          username
    Compression   yes

내가하면 ssh username@hostname효과가 있습니다.

사용해 보면 ssh_config다음과 같은 결과만 얻을 수 있습니다.

F:\>ssh -v hostname
OpenSSH_5.6p1, OpenSSL 0.9.8o 01 Jun 2010
debug1: Connecting to hostname [XX.XX.XX.XX] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /cygdrive/f/progs/OpenSSH/home/.ssh/id_rsa type -1
debug1: identity file /cygdrive/f/progs/OpenSSH/home/.ssh/id_rsa-cert type -1
debug1: identity file /cygdrive/f/progs/OpenSSH/home/.ssh/id_dsa type 2
debug1: identity file /cygdrive/f/progs/OpenSSH/home/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3p1 Debia
n-3ubuntu5
debug1: match: OpenSSH_5.3p1 Debian-3ubuntu5 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'hostname' is known and matches the RSA host key.
debug1: Found key in /cygdrive/f/progs/OpenSSH/home/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /cygdrive/f/progs/OpenSSH/home/.ssh/id_rsa
debug1: Offering DSA public key: /cygdrive/f/progs/OpenSSH/home/.ssh/id_dsa
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

나는 다음과 같은 인상을 받았습니다(이 질문에 설명된 대로:ssh가 올바른 사용자로 로그인하도록 만드는 방법은 무엇입니까?) User username에 지정하면 ssh_config작동합니다.

OpenSSH가 에 지정된 사용자 이름을 사용하지 않는 이유는 무엇입니까 ssh_config?

답변1

문제는 실제로 OpenSSH가 가 아닌 ~/.ssh/config( 로 확장됨 ) 에서 구성을 찾고 있다는 것입니다 ./cygdrive/f/progs/OpenSSH/home/.ssh/config/cygdrive/f/progs/OpenSSH/etc/ssh_config

대신 설정을 지정하세요 ~/.ssh/config.

답변2

이 문제를 발견하고 창에 갇힌 사람이라면 .ssh 폴더 위치에 대한 cygwin의 창은 환경에 지정한 $HOME 디렉터리가 아닙니다! cygwin openssh가 사용하는 경로는 /home/username/.ssh입니다.

내 수정은 /home/username 디렉토리를 제거하고 대신 실제 홈 디렉토리("cd ~"가 전환되는 디렉토리)에 심볼릭 링크하는 것이었습니다. 행운을 빌어요.

답변3

~/.ssh/config일반적으로 사용자 정의 사용자 구성 은 가 아닌 에 들어가야 합니다 /etc/ssh/config. /etc/ssh/config시스템 전반에 걸친 변경을 위한 것입니다.

관련 정보