pscp使用

来源:互联网 发布:淘宝特卖网qitemei 编辑:程序博客网 时间:2024/05/16 03:57

常用scp命令传输文件:
前服务器文件abc.sql传输到192.168.1.1服务器上,执行以下命令:

scp /home/person/1.txt root@192.168.1.1:/home/person/
 
回车后输入服务器密码即可。

 也可以使用以下命令:

pscp /home/person/1.txt root@192.168.1.1:/home/person/
 
同样回车后输入服务器密码。
 
pscp和scp功能相同,但pscp同时支持windows下使用,它有效解决了windows系统向linux服务器传输文件,而且它只有一个文件,即pscp.exe,建议将该文件放到C:\WINDOWS\system32下面,这样就可以在任何地方调用该文件命令,你也可以放在任意你指定文件夹下。


pscp语法基本与scp相同,但也有几个注意点:
    -p 拷贝文件的时候保留源文件建立的时间。
    -q 执行文件拷贝时,不显示任何提示消息。
    -r 拷贝整个目录
    -v 拷贝文件时,显示提示信息。


    Usage:
  pscp [options] [user@]host:source target
  pscp [options] source [source...] [user@]host
  pscp [options] -ls user@host:filespec


  用法:
  pscp [选项] [用户名@]主机:源文件 目标文件
  pscp [选项] 源文件 [源文件……] [用户名@]主机
  pscp [选项] -ls 用户名@主机:文件空间?


  Options:
  选项:
  -p preserve file attributes 保护文件属性
  -q quiet, don't show statistics 安静,不显示统计
  -r copy directories recursively 复制子文件夹
  -V print version information and exit 显示信息
  -v show verbose messages
  -load sessname Load settings from saved session
  -load 加载,加载保存节的设定
  -P port connect to specified port
  -P 端口,连接到指定空间端口
  -l user connect with specified username
  -l 用户,用指定的用户连接空间
  -pw passw login with specified password
  -pw 密码,用指定的密码登录空间
  -1/-2 强迫 ssh 使用的版本
  -4 -6 force use of IPv4 or IPv6
  -C 打开压缩
  -i key 钥匙,证明用的钥匙文件
  -batch 关闭交互能力,也许

  -unsafe 不安全,允许伺服端取代字符 (危险的)


scp出现ssh port 22: Connection refused 问题解决具体步骤


[root(0)@sys11 09:20:29 /home/work/Code_release/bj]# scp ./release.sh  root@192.168.161.151:/Users/a2014102/Downloads
ssh: connect to host 192.168.161.151 port 22: Connection refused
lost connection


Solution: 
One possible reason is that because the ssh server daemon, or sshd, is not loaded and running on localhost, so any attempt to ssh connect to localhost would fail. I check to see whether ssh and sshd are running by typing the following command:




$ ps aux | grep ssh  
# Result: bunch of lines, but none of them is about "sshd", only one line is about "ssh"  
 
Result is, I only see ssh running, but not sshd. So I know ssh server daemon is probably not started yet.
First, I verify that I have installed the package “openssh-server” on my fedora box.
Then I check the status of sshd service:
 
You may not have OpenSSH completely installed. Type this in terminal:



sudo apt-get install openssh-client  
sudo apt-get install openssh-server  
 
Another problem that you could have is that your firewall could be blocking the ssh connection. I use Firewall Configuration to manage my ports and firewall.
 
to restart it type


sudo /etc/init.d/ssh restart  
 
to stop it type

sudo /etc/init.d/ssh stop  
 
to start it type

sudo /etc/init.d/ssh start 

原创粉丝点击