使用scp在linux主机之间无密码复制文件/目录
当两台LINUX主机之间要互传文件时可使用SCP命令来实现,建立信任关系之后可不输入密码。
把你的本地主机用户的ssh公匙文件复制到远程主机用户的~/.ssh/authorized_keys文件中
假设本地主机linux100,远程主机linux200
一,在linux100主机里的用户
运行
#ssh-keygen -t rsa
结果如下
QUOTE:
Generating public/private rsa key pair.
Enter file in which to save the key (/home/.username/ssh/id_rsa):#回车
Enter passphrase (empty for no passphrase):#回车
Enter same passphrase again:#回车
Your identification has been saved in /home/.username /.ssh/id_rsa.
Your public key has been saved in /home/.username /.ssh/id_rsa.pub.
The key fingerprint is:
38:25:c1:4d:5d:d3:89:bb:46:67:bf:52:af:c3:17:0c username@localhost
Generating RSA keys:
Key generation complete.
会在用户目录~/.ssh/产生两个文件,id_rsa,id_rsa.pub
二,把linux100主机上的id_rsa.pub文件拷贝到linux200主机的root用户主目录下的.ssh目录下,并且改名为authorized_keys
即:
/root/.ssh/authorized_keys
这样在linux100主机上使用scp命令复制文件到linux200上将不提示输入密码了,直接复制了。
反之亦然!
三,复制文件或目录命令:
复制文件:
(1)将本地文件拷贝到远程
scp 文件名 --用户名@计算机IP或者计算机名称:远程路径
(2)从远程将文件拷回本地
scp --用户名@计算机IP或者计算机名称:文件名 本地路径
复制目录:
(1)将本地目录拷贝到远程
scp -r 目录名 用户名@计算机IP或者计算机名称:远程路径
(2)从远程将目录拷回本地
scp -r 用户名@计算机IP或者计算机名称:目录名本地路径
----------------------------------------------------------------------------------------------------------------------------------------------
把你的本地主机用户的ssh公匙文件写入到远程主机用户的~/.ssh/authorized_keys文件中,具体方法
假设本地主机localhost,远程主机remote
一,在localhost主机里的用户
运行 ssh-keygen -t rsa
结果如下
Generating public/private rsa key pair.
Enter file in which to save the key (/home/.username/ssh/id_rsa):#回车
Enter passphrase (empty for no passphrase):#回车
Enter same passphrase again:#回车
Your identification has been save
相关文档:
文章记录了作者在S3C2440开发板上实现按键点亮LED驱动开发的详细过程,还记录了一些容易出现的错误,以及怎么解决这些错误。
一、驱动开发流程
Linux驱动开发不同于应用程序的开发。驱动开发是直接和硬件打交道的,通过对硬件的操作给应用程序提供一些接口函数,使得应用程序能够&l ......
方法一、
bool ReadElemnt(string& szFileName)
{
TiXmlDocument myDocument(szFileName);
bool loadOkay = myDocument.LoadFile();
if(loadOkay == false)
return false;
TiXmlElement *rootElement = myDocument.RootElement();
if(rootEle ......
linux 小技巧
前言:因为用Linux的时间越来越长,所需要做的事也越来越多,效率成了我必需突破的瓶颈。在此总结一下这段时间用过的一些好的Linux技巧。以后时常补充这样自己要用的时候就很方便了。 Author:Ajian[文本处理]1、 ...
前言:因为用Linux的时间越来越长,所需要做的事也越来越多,效率成了我必需突破的瓶颈。 ......
装完
NeoShine
Linux 4.0
后,插上耳机后,耳机和喇叭同时发声。
要解决这个故障, 关键问题在于找到文件
ALSA-Configuration.txt
。
这个文件里有声卡类型与
model
(模块)的对照表。
下面是操作的正确步骤:
1
、下载声卡驱动程序、库文件、工具,下面是目前最新的驱动程序,下载网址:
驱动程序:
ftp: ......
how to install apache, PHP and MySQL on Linux
This tutorial explains the installation of Apache web server, bundled
with PHP and MySQL server on a Linux machine. The tutorial is primarily for SuSE
9.2, 9.3, 10.0 & 10.1, but most of the steps ought to be valid for all
Linux-like operating ......