无法连接SSH sh:6000:找不到命令

时间:2019-03-09 14:32:52

标签: linux ssh scp

我正在尝试连接服务器 和ssh给我看:class UserBasicForm(forms.ModelForm): class Meta(forms.ModelForm): model = CustomUser fields = ( 'username', 'first_name', 'last_name', ) labels = { 'username':'Username', 'first_name':'First Name', 'last_name':'Last Name', } class UserAddressForm(forms.ModelForm): class Meta(forms.ModelForm): model = UserAddress fields = ( 'description', 'addressee', 'company', 'address_1', 'address_2', 'city', 'prov_state', 'post_zip', 'country', ) labels = { 'description':'Address Description', 'addressee':'Addressee', 'company':'Company Name', 'address_1':'Address', 'address_2':'Address 2', 'city':'City', 'prov_state':'Province or State', 'post_zip':'Postal or Zip Code', 'country':'Country', } class CustomUser(AbstractUser): objects = CustomUserManager() def __str__(self): return self.email class UserAddress(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE,) description = models.CharField(max_length = 256, default='Description') addressee = models.CharField(max_length = 256,) company = models.CharField(max_length = 256, default='Self') address_1 = models.CharField(max_length = 256,) address_2 = models.CharField(max_length = 256,) city = models.CharField(max_length = 256,) prov_state = models.CharField(max_length = 256,) post_zip = models.CharField(max_length = 256,) country = models.CharField(max_length = 256,) def __str__(self): return self.description 打击是ssh详细日志和我的sshd_config。

sh: 6000: command not found

这是我的sshd配置

[~] # ssh -v admin@myserver -P 6000
OpenSSH_7.6p1, OpenSSL 1.0.2k  26 Jan 2017
debug1: Connecting to 192.168.50.21 [192.168.50.21] port 6000.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6
debug1: match: OpenSSH_7.6 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.50.216000 as 'admin'
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:XTuaKA/5nJd1wol9+Ckp0or8XCx3Rd/0NGMIdT9lrro
debug1: Host '192.168.50.21' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:2
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: Offering public key: RSA SHA256:XTuaKA/5nJd1wol9+Ckp0or8XCx3Rd/0NGMIdT9lrro /root/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Trying private key: /root/.ssh/id_ed25519
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
admin@192.168.50.21's password: 
debug1: Authentication succeeded (password).
Authenticated to 192.168.50.21 ([192.168.50.21]6000).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Sending command: 6000
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
sh: 6000: command not found
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2248, received 3052 bytes, in 0.2 seconds
Bytes per second: sent 14674.8, received 19923.2
debug1: Exit status 127

我不知道为什么在这里显示此错误。 而且我使用了一个名为ssh shell的mac软件,它可以连接到我的服务器。 我很确定密码正确。

1 个答案:

答案 0 :(得分:1)

您的命令行不执行您认为的操作。

ssh -v admin@myserver -P 6000
  • -v启用一些调试信息
  • admin@myserver提供远程用户和远程主机
  • -P 6000不会尝试连接到端口6000

您可能想要的命令是:

ssh -v admin@myserver -p 6000

但是,事实证明-P是ssh接受的undocumented argument

这将导致参数6000的下落不明。 ssh假定这是您要在远程服务器上运行的命令。它不存在,导致显示错误:

sh: 6000: command not found