scp

兼容所有系统的局域网传输文件通用方法

血红的双手。 提交于 2019-12-07 11:58:29
既然要通讯,那么必须有服务器和客户端。本文使用sshd做服务器,scp做客户端。 接受文件的一方必须使用sshd启动并绑定本机局域网端口,如0.0.0.0:22 绑定方法就是配置/etc/ssh/sshd_config这个配置文件,如果A(windows/linux/macos)向B(windows/linux/macos)发送文件,那么有两种方式: 假设A的用户名为userA,IP为192.168.1.10,文件路径/1.txt A运行sshd服务/usr/sbin/sshd,B运行scp userA@192.168.1.10:/1.txt 1.txt B运行sshd服务/usr/sbin/sshd,B运行scp 1.txt userA@192.168.1.10:/1.txt 这里有几点注意: 如何在windows上运行sshd服务器 linux怎么运行sshd就不必说了吧,很容易搜到。这里只讨论windows的,推荐git for windows自带的sshd.exe,scp.exe,ssh.exe,ssh所用账号密码也用windows自身账号密码即可。最好安装everything这个工具,可以搜到传过来的文件保存在哪里,git自带ssh根目录是git安装目录。注意git自带ssh的配置文件在:git根目录/etc/ssh/sshd_config

How can I configure an SCP/SFTP file storage?

大兔子大兔子 提交于 2019-12-07 07:25:42
问题 My Laravel application should copy files to another remote host. The remote host is accessible only via SCP with a private key. I would like to configure a new file storage (similarly as FTP), but I have found no information, how to define an SCP driver. 回答1: You'll need to install the SFTP driver for Flysystem, the library Laravel uses for its filesystem services: composer require league/flysystem-sftp Here's an example configuration that you can tweak. Add to the disks array in config

Adding Support for SCP and SFTP for Curl on Linux

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 20:32:26
I've been been desperately trying to add SFTP and SCP support for Curl on my CentOS box. I found something resembling a solution here: http://andrewberls.com/blog/post/adding-sftp-support-to-curl I followed these steps but found that when attempting to get a file via both SCP and SFTP, the connection hangs once the file has been found. I cannot fix this and cannot find an alternative solution. I have to use Curl for a job at work and therefore cannot use another lib. Has anyone managed to successfully add support for SCP and SFTP on Curl? I have a test server setup and other protocols such as

How to script multiple ssh and scp commands to various systems

醉酒当歌 提交于 2019-12-06 15:45:42
I would like to script a sequence of commands involving multiple ssh and scp calls. On a daily basis, I find myself manually performing this task: From LOCAL system, ssh to SYSTEM1 mkdir /tmp/data on SYSTEM1 from SYSTEM1, ssh to SYSTEM2 mkdir /tmp/data on SYSTEM2 from SYSTEM2, SSH to SYSTEM3 scp files from SYSTEM3:/data to SYSTEM2:/tmp/data exit to SYSTEM2 scp files from SYSTEM2:/data and SYSTEM2:/tmp/data to SYSTEM1:/tmp/data rm -fr SYSTEM2:/tmp/data exit to SYSTEM1 scp files from SYSTEM1:/data and SYSTEM1:/tmp/data to LOCAL:/data rm -fr SYSTEM1:/tmp/data I do this process at LEAST once a day

xsync和scp

怎甘沉沦 提交于 2019-12-06 14:33:25
1. scp(secure copy)安全拷贝 (1)scp 定义: scp 可以实现服务器与服务器之间的数据拷贝。(from server1 to server2) (2)基本语法 scp-r $pdir/$fname $user@elk-01$host:$pdir/$fname 命令 递归 要拷贝的文件路径/名称 目的用户@主机:目的路径/名称 2. rsync 远程同步工具 rsync 主要用于备份和镜像。具有速度快、避免复制相同内容和支持符号链接的优 点。rsync 和 scp 区别:用 rsync 做文件的复制要比 scp 的速度快,rsync 只对差异文件 做更新。scp 是把所有文件都复制过去。 (1)基本语法 rsync-rvl $pdir/$fname $user@elk-01$host:$pdir/$fname 命令 选项参数 要拷贝的文件路径/名称 目的用户@主机:目的路径/名称 #!/bin/bash #1 获取输入参数个数,如果没有参数,直接退出 pcount=$# if((pcount==0)); then echo no args; exit; fi #2 获取文件名称 p1=$1 fname=`basename $p1` echo fname=$fname #3 获取上级目录到绝对路径 pdir=`cd -P $(dirname $p1); pwd`

Scp command between 2 servers with 2 different .pem keys

拥有回忆 提交于 2019-12-06 10:16:54
问题 I want to transfer a folder from server A to server B with scp and 2 different .pem keys. Is this the best way to go about it and will this actually work. scp -i ~/Documents/server1.pem -r root@server1.com:~/location/to/dir -i ~/Documents/server2.pem ~/location/to/copy/to or do I have to input: scp -i ~/Documents/server1.pem -r root@server1.com:~/location/to/dir -i ~/Documents/server2.pem root@server2.com:~/location/to/copy/to I am just not sure with the second location if I need to input the

一步步教你搭建Hadoop集群

落花浮王杯 提交于 2019-12-06 08:33:00
一、准备工作 假设现在有4台机器,分别是:192.168.1.101,192.168.1.102,192.168.1.103,192.168.1.104。 这里以Centos7系统为例 (不同版本的Linux系统在做某些操作时命令不一样,可自行百度) 四个节点都有登录账户hadoop。 我们计划这么配置: 先关闭防火墙 systemctl stop firewalld . service systemctl stop iptables . service 然后再检查各机器的22端口是否开放 这里我们把ip映射成主机名,执行如下命令: vi / etc / hosts 在hosts文件中,编辑以下内容 192.168 . 1.101 node1 192.168 . 1.102 node2 192.168 . 1.103 node3 192.168 . 1.104 node4 保存退出 检查node1的3306端口是否开放 然后将hosts文件发送到其它节点上 scp / etc / hosts hadoop@node2 : /etc/ scp / etc / hosts hadoop@node3 : /etc/ scp / etc / hosts hadoop@node4 : /etc/ 在发送的过程中需要输入hadoop用户的密码 二、配置免密码登录 然后在家目录下执行 ssh -

Linux之scp命令的使用

不问归期 提交于 2019-12-06 08:21:36
Linux之scp命令的使用 1. scp简介 1.1 命令功能: scp是 secure copy的缩写, scp是linux系统下基于ssh登陆进行安全的远程文件拷贝命令。linux的scp命令可以在linux服务器之间复制文件和目录。 格式为:scp [可选参数] file_source file_target 1.2 命令参数 -1 强制scp命令使用协议ssh1 -2 强制scp命令使用协议ssh2 -4 强制scp命令只使用IPv4寻址 -6 强制scp命令只使用IPv6寻址 -B 使用批处理模式(传输过程中不询问传输口令或短语) -C 允许压缩。(将-C标志传递给ssh,从而打开压缩功能) -p 保留原文件的修改时间,访问时间和访问权限。 -q 不显示传输进度条。 -r 递归复制整个目录。 -v 详细方式显示输出。scp和ssh(1)会显示出整个过程的调试信息。这些信息用于调试连接,验证和配置问题。 -c cipher 以cipher将数据传输进行加密,这个选项将直接传递给ssh。 -F ssh_config 指定一个替代的ssh配置文件,此参数直接传递给ssh。 -i identity_file 从指定文件中读取传输时使用的密钥文件,此参数直接传递给ssh。 -l limit 限定用户所能使用的带宽,以Kbit/s为单位。 -o ssh_option

scp 拷贝 针对软连接的问题

和自甴很熟 提交于 2019-12-06 07:03:44
scp时经常把软连接变成拷贝了两遍,rsync -l可以避免这个问题 1. ln 软连接的scp 我们在系统中,经常用到软连接;当我们从远程机器scp 数据时,这个软连接不会cp过来;而是: 把软连接到的目录中的内容完全cp过来;这样之前的软连接就失效了;这样会造成一系列的问题。 2. scp 文件夹 正确的方法:tar 打包在解压 sudo tar -czvf test.tgz /..../test scp ~/test.tgz ./ sudo tar -xzvf ./test.tgz -C /   注释:将待远程拷贝的文件夹压缩之后再拷贝, 可以避免软连接的拷贝 利用tar等压缩命令将文件夹压缩 但是如果文件夹无法操作, 则需要用下面的命令替换。 注释:使用rsync命令可以避免软连接问题 # 列出几个参数如下, 具体请man rsync查看 -u, --update: skip files that are newer on the receiver 增量同步,跳过比本地较新的文件 -a, --archive: archive mode; equals -rlptgoD (no -H,-A,-X) 归档模式, 相当于-rlptgoD, 不包括(no -H,-A,-X);最常用的参数 -z, --compress: compress file data during the

python-scp-上传文件到服务器

随声附和 提交于 2019-12-06 02:53:42
python中使用scp,将文件上传到服务器 1 def ssh_scp_put(ip, username, password, local_file, remote_path): 2 """ 3 scp上传文件 4 :param ip: 5 :param username: 6 :param password: 7 :param local_file: 8 :param remote_path: 9 :return: 10 """ 11 ssh = paramiko.SSHClient() 12 ssh.load_system_host_keys() 13 ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) 14 15 ssh.connect(hostname=str(ip), port=22, username=username, password=password) 16 17 scp = SCPClient(ssh.get_transport()) 18 scp.put(local_file, recursive=True, remote_path=remote_path) 19 scp.close() 来源: https://www.cnblogs.com/sunshine-blog/p/11959223