首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么scp会给出这个奇怪的输出?

为什么scp会给出这个奇怪的输出?
EN

Unix & Linux用户
提问于 2021-01-31 12:18:51
回答 1查看 298关注 0票数 0

我有两台计算机(legendtelos)运行Debian11。出于某种原因,scp命令失败了,出现了一条奇怪的错误消息。

这是输出:

代码语言:javascript
复制
jj@telos:~$ scp test.txt legend.local:
   __                        __

如果我用相反的方法尝试,下划线和空格的数量会有所不同:

代码语言:javascript
复制
jj@legend:~$ scp telos.local:test.txt .
 ______    __

下面是带有-v参数的输出:

代码语言:javascript
复制
jj@telos:~$ scp -v test.txt legend.local:
Executing: program /usr/bin/ssh host legend.local, user (unspecified), command scp -v -t .
OpenSSH_8.4p1 Debian-3, OpenSSL 1.1.1i  8 Dec 2020
debug1: Reading configuration data /home/jj/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to legend.local [192.168.178.31] port 22.
debug1: Connection established.
debug1: identity file /home/jj/.ssh/id_rsa type 0
debug1: identity file /home/jj/.ssh/id_rsa-cert type -1
debug1: identity file /home/jj/.ssh/id_dsa type -1
debug1: identity file /home/jj/.ssh/id_dsa-cert type -1
debug1: identity file /home/jj/.ssh/id_ecdsa type -1
debug1: identity file /home/jj/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/jj/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/jj/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/jj/.ssh/id_ed25519 type -1
debug1: identity file /home/jj/.ssh/id_ed25519-cert type -1
debug1: identity file /home/jj/.ssh/id_ed25519_sk type -1
debug1: identity file /home/jj/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/jj/.ssh/id_xmss type -1
debug1: identity file /home/jj/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.4p1 Debian-3
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.4p1 Debian-3
debug1: match: OpenSSH_8.4p1 Debian-3 pat OpenSSH* compat 0x04000000
debug1: Authenticating to legend.local:22 as 'jj'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC:  compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC:  compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:IUzxufu5zBuFsNU/SyjfpFr7U4bvqfsXVdP/6CTstUw
debug1: Host 'legend.local' is known and matches the ECDSA host key.
debug1: Found key in /home/jj/.ssh/known_hosts:44
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/jj/.ssh/id_rsa RSA SHA256:FND4H+2/T2jRUqT9+aNHocv5Mg7yjfS3WtQGaC9aQR8
debug1: Will attempt key: /home/jj/.ssh/id_dsa 
debug1: Will attempt key: /home/jj/.ssh/id_ecdsa 
debug1: Will attempt key: /home/jj/.ssh/id_ecdsa_sk 
debug1: Will attempt key: /home/jj/.ssh/id_ed25519 
debug1: Will attempt key: /home/jj/.ssh/id_ed25519_sk 
debug1: Will attempt key: /home/jj/.ssh/id_xmss 
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/jj/.ssh/id_rsa RSA SHA256:FND4H+2/T2jRUqT9+aNHocv5Mg7yjfS3WtQGaC9aQR8
debug1: Server accepts key: /home/jj/.ssh/id_rsa RSA SHA256:FND4H+2/T2jRUqT9+aNHocv5Mg7yjfS3WtQGaC9aQR8
debug1: Authentication succeeded (publickey).
Authenticated to legend.local ([192.168.178.31]:22).
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: Remote: /home/jj/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Remote: /home/jj/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Sending environment.
debug1: Sending env LANG = en_GB.UTF-8
debug1: Sending command: scp -v -t .
   __                        __
debug1: client_input_channel_req: channel 0 rtype exit-signal reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Transferred: sent 2920, received 3300 bytes, in 0.5 seconds
Bytes per second: sent 6164.1, received 6966.2
debug1: Exit status -1
jj@telos:~$ 

当然,______ __是我收到过的最奇怪的错误信息。怎么啦?

EN

回答 1

Unix & Linux用户

发布于 2021-01-31 12:41:17

问题是两方面的。首先,在我的~/.profile中有以下声明:

代码语言:javascript
复制
. ~/.bashrc

其次,我的~/.bashrc中有以下声明:

代码语言:javascript
复制
name=$(hostname)
figlet -f smslant ${name^}

这将在登录到legend时产生以下输出:

代码语言:javascript
复制
   __                        __
  / /  ___ ___ ____ ___  ___/ /
 / /__/ -_) _ `/ -_) _ \/ _  / 
/____/\__/\_, /\__/_//_/\_,_/  
         /___/                 

注意到上面的那一行了吗?这就是scp所输出的台词!我通过在~/.bashrc中加上以下内容来解决这个问题:

代码语言:javascript
复制
# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac
票数 3
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/631911

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档