加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

使用scp命令“bash:scp:command not found”时出错

发布时间:2020-12-15 16:23:20 所属栏目:安全 来源:网络整理
导读:我想使用scp命令将本地文件复制到远程服务器,但是我在远程服务器中输入用户的密码后收到一条错误消息。 ~]$ scp gitadmin.pub git@123.150.207.18:git@123.150.207.18's password: bash: scp: command not foundlost connection 我在使用git用户的服务器上
我想使用scp命令将本地文件复制到远程服务器,但是我在远程服务器中输入用户的密码后收到一条错误消息。
~]$ scp gitadmin.pub git@123.150.207.18:
git@123.150.207.18's password: 
bash: scp: command not found
lost connection

我在使用git用户的服务器上检查,似乎scp命令可以找到,openssh-clinets也安装了。

git@... ~]$ scp
usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
           [-l limit] [-o ssh_option] [-P port] [-S program]
           [[user@]host1:]file1 ... [[user@]host2:]file2
git@... ~]$ su root
......
root@... ~]# yum info openssh-clients
Loaded plugins: product-id,subscription-manager
Updating Red Hat repositories.
Installed Packages
Name        : openssh-clients
Arch        : x86_64
Version     : 5.3p1
Release     : 52.el6
Size        : 1.0 M
Repo        : installed
From repo   : anaconda-RedHatEnterpriseLinux-201105101844.x86_64
Summary     : An open source SSH client applications
URL         : http://www.openssh.com/portable.html
License     : BSD
Description : OpenSSH is a free version of SSH (Secure SHell),a program for
            : logging into and executing commands on a remote machine. This
            : package includes the clients necessary to make encrypted
            : connections to SSH servers.

我困惑的情况。我在服务器上缺少一些配置吗? (我们使用RHEL6作为服务器。)

这是我在路径设置的错误。
我在/etc/profile.d中添加了’custom.sh’,并在其中添加了以下行,以将/usr/local/node / bin目录添加到PATH。

export PATH="/usr/local/node/bin:$PATH"

但格式是错误的。我删除了一对’“’,它现在工作正常,应该是:

export PATH=$PATH:/usr/local/node/bin

探头错误… ^ _ ^

确保scp命令在客户端和服务器上都可用。

如果这是Fedora或Red Hat Enterprise Linux和克隆(CentOS),请确保已安装此软件包:

yum -y install openssh-clients

如果您使用Debian或Ubuntu和克隆,请安装此软件包:

apt-get install openssh-client

同样,你需要在服务器和客户端上这样做,否则你可能会遇到客户端上的“奇怪”错误消息:scp:command not found或类似,尽管你在本地。这已经困惑成千上万的人,我猜:)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读