我可以以 root 和管理员身份进行 ssh,但不能以非管理员用户身份进行 ssh。以下是尝试的日志:
% ssh -vvv -i ~/.ssh/diskstation-rsync-key [email protected]
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /home/hughdbrown/.ssh/config
debug1: /home/hughdbrown/.ssh/config line 85: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: auto-mux: Trying existing master
debug1: Control socket "/tmp/[email protected]:22" does not exist
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.2.130 [192.168.2.130] port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/hughdbrown/.ssh/local/diskstation-rsync-key" as a RSA1 public key
debug1: identity file /home/hughdbrown/.ssh/local/diskstation-rsync-key type 2
debug1: identity file /home/hughdbrown/.ssh/local/diskstation-rsync-key-cert type -1
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/hughdbrown/.ssh/id_rsa" as a RSA1 public key
debug1: identity file /home/hughdbrown/.ssh/id_rsa type 1
debug1: identity file /home/hughdbrown/.ssh/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.8p1-hpn13v11
debug1: match: OpenSSH_5.8p1-hpn13v11 pat OpenSSH_5* compat 0x0c000000
debug2: fd 3 setting O_NONBLOCK
debug3: load_hostkeys: loading entries for host "192.168.2.130" from file "/home/hughdbrown/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file /home/hughdbrown/.ssh/known_hosts:228
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: [email protected],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: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],[email protected],[email protected],[email protected],ssh-ed25519,ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,[email protected],zlib
debug2: kex_parse_kexinit: none,[email protected],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: 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-rsa,ssh-dss,ecdsa-sha2-nistp256
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,[email protected]
debug2: kex_parse_kexinit: none,[email protected]
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: setup hmac-md5
debug1: kex: server->client aes128-ctr hmac-md5 none
debug2: mac_setup: setup hmac-md5
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 17:46:85:9d:58:b4:db:9b:54:19:7f:e4:7c:60:c6:1f
debug3: load_hostkeys: loading entries for host "192.168.2.130" from file "/home/hughdbrown/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file /home/hughdbrown/.ssh/known_hosts:228
debug3: load_hostkeys: loaded 1 keys
debug1: Host '192.168.2.130' is known and matches the ECDSA host key.
debug1: Found key in /home/hughdbrown/.ssh/known_hosts:228
debug1: ssh_ecdsa_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/hughdbrown/.ssh/id_rsa (0x7f7e359e50b0), explicit
debug2: key: hughdbrown@hughdbrown-XPS-15-9530 (0x7f7e359e4ae0),
debug2: key: /home/hughdbrown/.ssh/local/diskstation-rsync-key (0x7f7e359e36f0), explicit
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/hughdbrown/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: hughdbrown@hughdbrown-XPS-15-9530
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Offering DSA public key: /home/hughdbrown/.ssh/local/diskstation-rsync-key
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-dss blen 433
debug2: input_userauth_pk_ok: fp dc:8d:59:20:af:f5:17:6d:4f:f5:8e:0a:44:c6:52:1c
debug3: sign_and_send_pubkey: DSA dc:8d:59:20:af:f5:17:6d:4f:f5:8e:0a:44:c6:52:1c
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type DSA
debug1: Authentication succeeded (publickey).
Authenticated to 192.168.2.130 ([192.168.2.130]:22).
debug1: setting up multiplex master socket
debug3: muxserver_listen: temporary control path /tmp/[email protected]:22.lmKrPFcqz5Ll3VdA
debug2: fd 4 setting O_NONBLOCK
debug3: fd 4 is O_NONBLOCK
debug3: fd 4 is O_NONBLOCK
debug1: channel 0: new [/tmp/[email protected]:22]
debug3: muxserver_listen: mux listener channel 0 fd 4
debug1: channel 1: new [client-session]
debug3: ssh_session2_open: channel_new: 1
debug2: channel 1: send open
debug1: Entering interactive session.
debug2: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: packet_set_tos: set IP_TOS 0x10
debug2: client_session2_setup: id 1
debug2: channel 1: request pty-req confirm 1
debug1: Sending environment.
debug3: Ignored env XDG_CONFIG_DIRS
debug1: Sending env LANG = en_US.UTF-8
debug2: channel 1: request env confirm 0
debug3: Ignored env DISPLAY
debug3: Ignored env XDG_VTNR
debug3: Ignored env LOGNAME
debug3: Ignored env PWD
debug3: Ignored env MANDATORY_PATH
debug3: Ignored env GNOME_KEYRING_PID
debug3: Ignored env XAUTHORITY
debug3: Ignored env COLORTERM
debug3: Ignored env XDG_SESSION_ID
debug3: Ignored env MDM_LANG
debug3: Ignored env DESKTOP_SESSION
debug3: Ignored env MDMSESSION
debug3: Ignored env XDG_SESSION_DESKTOP
debug3: Ignored env DEFAULTS_PATH
debug3: Ignored env GNOME_KEYRING_CONTROL
debug3: Ignored env TEXTDOMAINDIR
debug3: Ignored env WINDOWPATH
debug3: Ignored env USERNAME
debug3: Ignored env TEXTDOMAIN
debug3: Ignored env GDMSESSION
debug3: Ignored env MDM_XSERVER_LOCATION
debug3: Ignored env DBUS_SESSION_BUS_ADDRESS
debug3: Ignored env GNOME_DESKTOP_SESSION_ID
debug3: Ignored env VTE_VERSION
debug3: Ignored env GDM_XSERVER_LOCATION
debug3: Ignored env XDG_DATA_DIRS
debug3: Ignored env GJS_DEBUG_TOPICS
debug3: Ignored env XDG_SESSION_COOKIE
debug3: Ignored env SHELL
debug3: Ignored env GJS_DEBUG_OUTPUT
debug3: Ignored env WINDOWID
debug3: Ignored env SSH_AGENT_PID
debug3: Ignored env SESSION_MANAGER
debug3: Ignored env SSH_AUTH_SOCK
debug3: Ignored env XDG_CURRENT_DESKTOP
debug3: Ignored env PATH
debug3: Ignored env TERM
debug3: Ignored env HOME
debug3: Ignored env XDG_SEAT
debug3: Ignored env CINNAMON_VERSION
debug3: Ignored env XDG_RUNTIME_DIR
debug3: Ignored env GPG_AGENT_INFO
debug3: Ignored env USER
debug3: Ignored env SHLVL
debug3: Ignored env OLDPWD
debug3: Ignored env GREP_OPTIONS
debug3: Ignored env GREP_COLOR
debug3: Ignored env PAGER
debug3: Ignored env LESS
debug1: Sending env LC_CTYPE = en_US.UTF-8
debug2: channel 1: request env confirm 0
debug3: Ignored env LSCOLORS
debug3: Ignored env VIRTUAL_ENV_DISABLE_PROMPT
debug3: Ignored env VIRTUALENVWRAPPER_PROJECT_FILENAME
debug3: Ignored env VIRTUALENVWRAPPER_SCRIPT
debug3: Ignored env WORKON_HOME
debug3: Ignored env VIRTUALENVWRAPPER_HOOK_DIR
debug3: Ignored env ZSH_TMUX_TERM
debug3: Ignored env _ZSH_TMUX_FIXED_CONFIG
debug3: Ignored env ANT_HOME
debug3: Ignored env VISUAL
debug3: Ignored env EDITOR
debug3: Ignored env HISTCONTROL
debug3: Ignored env HISTSIZE
debug3: Ignored env HISTFILESIZE
debug3: Ignored env PYTHONPATH
debug3: Ignored env ORACLE_HOME
debug3: Ignored env LD_LIBRARY_PATH
debug3: Ignored env TNS_ADMIN
debug3: Ignored env ORACLE_SID
debug3: Ignored env PERL_LOCAL_LIB_ROOT
debug3: Ignored env PERL_MB_OPT
debug3: Ignored env PERL_MM_OPT
debug3: Ignored env PERL5LIB
debug3: Ignored env PYTHONSTARTUP
debug3: Ignored env RVM_BIN
debug3: Ignored env rvm_prefix
debug3: Ignored env rvm_path
debug3: Ignored env rvm_bin_path
debug3: Ignored env _system_type
debug3: Ignored env _system_name
debug3: Ignored env _system_version
debug3: Ignored env _system_arch
debug3: Ignored env rvm_version
debug3: Ignored env GEM_HOME
debug3: Ignored env GEM_PATH
debug3: Ignored env MY_RUBY_HOME
debug3: Ignored env IRBRC
debug3: Ignored env VIRTUALENVWRAPPER_VIRTUALENV_ARGS
debug3: Ignored env PIP_VIRTUALENV_BASE
debug3: Ignored env PIP_RESPECT_VIRTUALENV
debug3: Ignored env ASSESS_HOME
debug3: Ignored env rvm_alias_expanded
debug3: Ignored env rvm_docs_type
debug3: Ignored env rvm_gemstone_package_file
debug3: Ignored env rvm_gemstone_url
debug3: Ignored env rvm_niceness
debug3: Ignored env rvm_nightly_flag
debug3: Ignored env rvm_proxy
debug3: Ignored env rvm_quiet_flag
debug3: Ignored env rvm_ruby_file
debug3: Ignored env rvm_ruby_make
debug3: Ignored env rvm_ruby_make_install
debug3: Ignored env rvm_ruby_mode
debug3: Ignored env rvm_script_name
debug3: Ignored env rvm_sdk
debug3: Ignored env rvm_silent_flag
debug3: Ignored env rvm_wrapper_name
debug3: Ignored env VIRTUAL_ENV
debug3: Ignored env CD_VIRTUAL_ENV
debug3: Ignored env rvm_hook
debug3: Ignored env _
debug2: channel 1: request shell confirm 1
debug2: callback done
debug2: channel 1: open confirm rwindow 0 rmax 32768
debug2: channel_input_status_confirm: type 99 id 1
debug2: PTY allocation request accepted on channel 1
debug2: channel 1: rcvd adjust 87380
debug2: channel_input_status_confirm: type 99 id 1
debug2: shell request accepted on channel 1
Permission denied, please try again.
debug2: channel 1: rcvd eof
debug2: channel 1: output open -> drain
debug2: channel 1: obuf empty
debug2: channel 1: close_write
debug2: channel 1: output drain -> closed
debug1: client_input_channel_req: channel 1 rtype exit-status reply 0
debug1: client_input_channel_req: channel 1 rtype [email protected] reply 0
debug2: channel 1: rcvd eow
debug2: channel 1: close_read
debug2: channel 1: input open -> closed
debug2: channel 1: rcvd close
debug3: channel 1: will not send data after close
debug2: channel 1: almost dead
debug2: channel 1: gc: notify user
debug2: channel 1: gc: user detached
debug2: channel 1: send close
debug2: channel 1: is dead
debug2: channel 1: garbage collecting
debug1: channel 1: free: client-session, nchannels 2
debug3: channel 1: status: The following connections are open:
#1 client-session (t4 r0 i3/0 o3/0 fd -1/-1 cc -1)
debug1: channel 0: free: /tmp/[email protected]:22, nchannels 1
debug3: channel 0: status: The following connections are open:
Connection to 192.168.2.130 closed.
Transferred: sent 4528, received 2112 bytes, in 0.0 seconds
Bytes per second: sent 432054.2, received 201523.5
debug1: Exit status 1
我已经做了一切这个帖子。 我有:
- 与位置匹配的主目录
/etc/passwd
为 755 - ~/.ssh 是 700
- ~/.ssh/authorized_keys 具有正确的密钥且权限为 644
/etc/ssh/sshd_config 有这个额外的配置:
PubkeyAuthentication 是
AuthorizedKeysFile .ssh/authorized_keys 匹配用户 hughdbrown AuthorizedKeysFile /var/services/homes/hughdbrown/.ssh/authorized_keys
看起来圆木连接正确,但后来又断开了。不知道发生了什么。
答案1
问题出在我的 shell 上。我试图使用/opt/bin/zsh
。尽管已经安装了,但从 ssh 运行它会导致失败。
我以 root 身份登录然后:
sed -i 's|/opt/bin/zsh|/bin/sh|' /etc/passwd
然后非root登录就没问题了。