使用ssh进行远程连接 - 拒绝权限

时间:2013-10-27 10:39:52

标签: linux ssh

我正在使用ubuntu 12.04(桌面版)并在其上安装ssh。我想远程使用我的笔记本电脑(win8 64)访问我的桌面资源。在我的笔记本电脑上,我安装了cygwin。当我在家里使用它时,通过我的私人网络一切都很完美 - 没有密码验证,权限被拒等问题。当我尝试远程连接到我的桌面时,问题就出现了。为了检查我的路由器IP,我使用了whatismyipadress.com网站。我想我正确地转发了我的端口22。我用这样的方式玩它:

  1. sudo start ssh(在我的桌面上)
  2. ssh -vv -p 22 kotu @ ipadressofrouter
  3. 我从我的cygwin终端获得了这样的信息

    OpenSSH_6.3, OpenSSL 1.0.1e 11 Feb 2013
    debug1: Reading configuration data /home/Krystyna/.ssh/config
    debug2: ssh_connect: needpriv 0
    debug1: Connecting to 82.160.125.184 [82.160.125.184] port 22.
    debug1: Connection established.
    debug1: identity file /home/Krystyna/.ssh/id_rsa type -1
    debug1: identity file /home/Krystyna/.ssh/id_rsa-cert type -1
    debug1: identity file /home/Krystyna/.ssh/id_dsa type -1
    debug1: identity file /home/Krystyna/.ssh/id_dsa-cert type -1
    debug1: identity file /home/Krystyna/.ssh/id_ecdsa type -1
    debug1: identity file /home/Krystyna/.ssh/id_ecdsa-cert type -1
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_6.3
    debug1: Remote protocol version 1.99, remote software version OpenSSH_2.3.0_Mikrotik_v2.9
    debug1: match: OpenSSH_2.3.0_Mikrotik_v2.9 pat OpenSSH_2.3.0*
    debug2: fd 3 setting O_NONBLOCK
    debug2: Original cipher proposal: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
    debug2: Compat cipher proposal: arcfour256,arcfour128,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,rijndael-cbc@lysator.liu.se
    debug2: Original cipher proposal: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
    debug2: Compat cipher proposal: arcfour256,arcfour128,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,rijndael-cbc@lysator.liu.se
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
    debug2: kex_parse_kexinit: ssh-dss-cert-v01@openssh.com,ssh-dss-cert-v00@openssh.com,ssh-dss,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa
    debug2: kex_parse_kexinit: arcfour256,arcfour128,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,rijndael-cbc@lysator.liu.se
    debug2: kex_parse_kexinit: arcfour256,arcfour128,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,rijndael-cbc@lysator.liu.se
    debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
    debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
    debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
    debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
    debug2: kex_parse_kexinit:
    debug2: kex_parse_kexinit:
    debug2: kex_parse_kexinit: first_kex_follows 0
    debug2: kex_parse_kexinit: reserved 0
    debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
    debug2: kex_parse_kexinit: ssh-dss
    debug2: kex_parse_kexinit: 3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes128-cbc,aes192-cbc,aes256-cbc,rijndael128-cbc,rijndael192-cbc,rijndael256-cbc,rijndael-cbc@lysator.liu.se
    debug2: kex_parse_kexinit: 3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes128-cbc,aes192-cbc,aes256-cbc,rijndael128-cbc,rijndael192-cbc,rijndael256-cbc,rijndael-cbc@lysator.liu.se
    debug2: kex_parse_kexinit: hmac-sha1,hmac-md5,hmac-ripemd160@openssh.com
    debug2: kex_parse_kexinit: hmac-sha1,hmac-md5,hmac-ripemd160@openssh.com
    debug2: kex_parse_kexinit: none,zlib
    debug2: kex_parse_kexinit: none,zlib
    debug2: kex_parse_kexinit:
    debug2: kex_parse_kexinit:
    debug2: kex_parse_kexinit: first_kex_follows 0
    debug2: kex_parse_kexinit: reserved 0
    debug2: mac_setup: found hmac-md5
    debug1: kex: server->client 3des-cbc hmac-md5 none
    debug2: mac_setup: found hmac-md5
    debug1: kex: client->server 3des-cbc hmac-md5 none
    debug1: SSH2_MSG_KEX_DH_GEX_REQUEST_OLD(2048) sent
    debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
    debug2: dh_gen_key: priv key bits set: 208/384
    debug2: bits set: 478/1024
    debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
    debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
    debug1: Server host key: DSA 7f:74:c1:be:c8:9f:12:b0:44:dd:58:ed:9f:83:2d:8e
    debug1: Host '82.160.125.184' is known and matches the DSA host key.
    debug1: Found key in /home/Krystyna/.ssh/known_hosts:2
    debug2: bits set: 527/1024
    debug1: ssh_dss_verify: signature correct
    debug2: kex_derive_keys
    debug2: set_newkeys: mode 1
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug2: set_newkeys: mode 0
    debug1: SSH2_MSG_NEWKEYS received
    debug1: Roaming not allowed by server
    debug1: SSH2_MSG_SERVICE_REQUEST sent
    debug2: service_accept: ssh-userauth
    debug1: SSH2_MSG_SERVICE_ACCEPT received
    debug2: key: /home/Krystyna/.ssh/id_rsa (0x0),
    debug2: key: /home/Krystyna/.ssh/id_dsa (0x0),
    debug2: key: /home/Krystyna/.ssh/id_ecdsa (0x0),
    debug1: Authentications that can continue: publickey,password
    debug1: Next authentication method: publickey
    debug1: Trying private key: /home/Krystyna/.ssh/id_rsa
    debug1: Trying private key: /home/Krystyna/.ssh/id_dsa
    debug1: Trying private key: /home/Krystyna/.ssh/id_ecdsa
    debug2: we did not send a packet, disable method
    debug1: Next authentication method: password
    kotu1@82.160.125.184's password:
    debug2: we sent a password packet, wait for reply
    debug1: Authentications that can continue: publickey,password
    Permission denied, please try again.
    kotu1@82.160.125.184's password:
    debug2: we sent a password packet, wait for reply
    debug1: Authentications that can continue: publickey,password
    Permission denied, please try again.
    

    我的sshd_config文件:

    # Package generated configuration file
    # See the sshd_config(5) manpage for details
    # What ports, IPs and protocols we listen for
    Port 22
    # Use these options to restrict which interfaces/protocols sshd will bind to
    #ListenAddress ::
    #ListenAddress 0.0.0.0
    Protocol 2
    # HostKeys for protocol version 2
    HostKey /etc/ssh/ssh_host_rsa_key
    HostKey /etc/ssh/ssh_host_dsa_key
    HostKey /etc/ssh/ssh_host_ecdsa_key
    #Privilege Separation is turned on for security
    UsePrivilegeSeparation yes
    # Lifetime and size of ephemeral version 1 server key
    KeyRegenerationInterval 3600
    ServerKeyBits 768
    # Logging
    SyslogFacility AUTH
    LogLevel INFO
    # Authentication:
    LoginGraceTime 120
    PermitRootLogin yes
    StrictModes yes
    RSAAuthentication no
    PubkeyAuthentication no
    #AuthorizedKeysFile     %h/.ssh/authorized_keys
    # Don't read the user's ~/.rhosts and ~/.shosts files
    IgnoreRhosts yes
    # For this to work you will also need host keys in /etc/ssh_known_hosts
    RhostsRSAAuthentication no
    # similar for protocol version 2
    HostbasedAuthentication no
    # Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
    #IgnoreUserKnownHosts yes
    # To enable empty passwords, change to yes (NOT RECOMMENDED)
    PermitEmptyPasswords no
    # Change to yes to enable challenge-response passwords (beware issues with
    # some PAM modules and threads)
    ChallengeResponseAuthentication no
    # Change to no to disable tunnelled clear text passwords
    #PasswordAuthentication yes
    # Kerberos options
    #KerberosAuthentication no
    #KerberosGetAFSToken no
    #KerberosOrLocalPasswd yes
    #KerberosTicketCleanup yes
    # GSSAPI options
    #GSSAPIAuthentication no
    #GSSAPICleanupCredentials yes
    X11Forwarding yes
    X11DisplayOffset 10
    PrintMotd no
    PrintLastLog yes
    TCPKeepAlive yes
    #UseLogin no
    #MaxStartups 10:30:60
    #Banner /etc/issue.net
    # Allow client to pass locale environment variables
    AcceptEnv LANG LC_*
    Subsystem sftp /usr/lib/openssh/sftp-server
    # Set this to 'yes' to enable PAM authentication, account processing,
    # and session processing. If this is enabled, PAM authentication will
    # be allowed through the ChallengeResponseAuthentication and
    # PasswordAuthentication.  Depending on your PAM configuration,
    # PAM authentication via ChallengeResponseAuthentication may bypass
    # the setting of "PermitRootLogin without-password".
    # If you just want the PAM account and session checks to run without
    # PAM authentication, then enable this but set PasswordAuthentication
    # and ChallengeResponseAuthentication to 'no'.
    UsePAM no
    

    预先提示任何提示。

1 个答案:

答案 0 :(得分:0)

如何生成公钥? 也许试试ssh-key -t rsa