ssh

scp命令详解

╄→гoц情女王★ 提交于 2020-03-05 06:14:57
先说下常用的情况: 两台机器IP分别为:A.104.238.161.75,B.43.224.34.73。 在A服务器上操作,将B服务器上/home/lk/目录下所有的文件全部复制到本地的/root目录下,命令为:scp -r root@43.224.34.73:/home/lk /root。 具体过程为: [root@XX ~]# scp -r root@43.224.34.73:/home/lk /root root@43.224.34.73's password: k2.sql 100% 0 0.0KB/s 00:00 k.zip 100% 176 0.2KB/s 00:00 .bash_history 100% 32 0.0KB/s 00:00 .bash_logout 100% 18 0.0KB/s 00:00 .bashrc 100% 231 0.2KB/s 00:00 k3.sql 100% 0 0.0KB/s 00:00 .bash_profile 100% 193 0.2KB/s 00:00 [root@XX ~]# ls 在A服务器上将/root/lk目录下所有的文件传输到B的/home/lk/cpfile目录下,命令为:scp -r /root/lk root@43.224.34.73:/home/lk/cpfile。 具体过称为: [root@XX lk]#

树莓派:漂洋过海来看你

寵の児 提交于 2020-03-05 01:53:56
作者:Vamei 出处:http://www.cnblogs.com/vamei 严禁任何形式转载。 给树莓派连上显示器和键盘鼠标,就可以像使用一台电脑一样使用它了。但很多时候,我们是把体积小巧的树莓派当做一个便携设备来使用的。这种时候,用户可不希望随身带着体积庞大的鼠标、键盘和显示器。如果能用手中的电脑直接连接树莓派,然后用该电脑的输入输出设备来操纵树莓派电脑,就可以省去很多不必要的麻烦。除此之外,树莓派在物联网情境下的应用,也离不开多样的远程连接方式。 局域网SSH登陆 常见的家庭或办公网络都是以一个WiFi路由器为中心的。这种局域网场景下,可以很容易的用SSH的方式来远程登陆树莓派。SSH是用于远程服务器管理的加密协议。SSH分为服务器和客户端两端。树莓派将作为服务器端,而同一局域网下的另一台电脑可以作为客户端。客户端成功登陆之后,我们可以从客户端用命令行的方式来远程操作服务器端。 首先,我们需要开启树莓派上的SSH服务器。树莓派已经预装好了SSH服务器,我们只需要进入树莓派的设置页面开启就可以。从终端用命令行进入设置页面: sudo raspi-config 然后在"5 Interfacing Options" -> "P2 SSH"中打开SSH服务器: 为了远程连接,我们必须知道树莓派的IP地址。在树莓派上,我们可以用ifconfig命令来找到树莓派的IP地址:

ssh tunnel

空扰寡人 提交于 2020-03-04 23:49:23
server A B C D <A> <B> <C> <D> - Local -- Forward local port to remote host. - Remote -- Forward remote port to local host. - Dynamic -- Use SOCKS. #--------------------------------------------------------------- <A>$ ssh -L 8888:<C>:22 root@<B> <A> 打开本地8888端口,访问<A>的8888端口,实现通过 <B> 跳转到<C>的22端口 #----------------------------------------------------------------- <B> sshd_config GatewayPorts no # 不允许外部访问<B> GatewayPorts yes # 允许外部访问<B>的端口 GatewayPorts clientspecified # 指定被允许的外部IP <C>$ ssh -R 8888:localhost:22 root@<B> <A>访问<B>的8888端口,实现通过 <B> 跳转到<C>的22端口 <C>$ ssh -R 8888:<D>:22 root@<B> <A>访问<B

一客户端使用多个密钥对登录多个主机的解决方案.

安稳与你 提交于 2020-03-04 22:33:36
来自:https://www.zhihu.com/question/29864641/answer/124695532 比如 github 、bitbucket ,出现了好几次无法提交和拉取的问题,我才意识到我多次修改了 id_rsa 文件,为不同的 git 服务创建 ssh key 的同时也覆盖了之前 git 服务器的 key 。心想肯定有办法让多个服务共存 创建密钥 1.创建一个密钥 $ ssh-keygen -t rsa 2.输入保存ssh key 密钥的文件名称 id_rsa_github 。 Enter file in which to save the key (/root/.ssh/id_rsa):/root/.ssh/id_rsa_aaa 3.输入两次密码,要求最低不能低于8位。 Enter passphrase (empty for no passphrase): Enter same passphrase again: 重复上面的步骤可以创建多个密钥,比如你有多个git账户 id_rsa_github id_rsa_bitbucket id_rsa_oschina 添加到 ssh-agent 用ssh-add命令把创建的密钥添加到 ssh-agent 里 $ ssh-add ~/.ssh/id_rsa_github $ ssh-add ~/.ssh/id_rsa

Pass commands as input to another command (su, ssh, sh, etc)

限于喜欢 提交于 2020-03-04 21:57:44
问题 I have a script where I need to start a command, then pass some additional commands as commands to that command. I tried su echo I should be root now: who am I exit echo done. ... but it doesn't work: The su succeeds, but then the command prompt is just staring at me. If I type exit at the prompt, the echo and who am i etc start executing! And the echo done. doesn't get executed at all. Similarly, I need for this to work over ssh : ssh remotehost # this should run under my account on

Pass commands as input to another command (su, ssh, sh, etc)

一世执手 提交于 2020-03-04 21:52:50
问题 I have a script where I need to start a command, then pass some additional commands as commands to that command. I tried su echo I should be root now: who am I exit echo done. ... but it doesn't work: The su succeeds, but then the command prompt is just staring at me. If I type exit at the prompt, the echo and who am i etc start executing! And the echo done. doesn't get executed at all. Similarly, I need for this to work over ssh : ssh remotehost # this should run under my account on

Pass commands as input to another command (su, ssh, sh, etc)

余生颓废 提交于 2020-03-04 21:52:04
问题 I have a script where I need to start a command, then pass some additional commands as commands to that command. I tried su echo I should be root now: who am I exit echo done. ... but it doesn't work: The su succeeds, but then the command prompt is just staring at me. If I type exit at the prompt, the echo and who am i etc start executing! And the echo done. doesn't get executed at all. Similarly, I need for this to work over ssh : ssh remotehost # this should run under my account on

git本地绑定github

大城市里の小女人 提交于 2020-03-04 19:44:58
首先需要安装好git,注册好github账号 生成公钥 在任意处,git bash,输入以下命令 ssh - keygen - t rsa - b 4096 - C "注册github的邮箱" Generating public / private rsa key pair . Enter file in which to save the key ( / c / Users / Administrator / . ssh / id_rsa ) :“输入保存密钥的文件的文件名,可直接回车” Enter passphrase ( empty for no passphrase ) :“可直接回车” Enter same passphrase again:“可直接回车” Your public key has been saved in id_rsa . pub . The key fingerprint is: SHA256:NCYQZN5 + D4HI9ZhuILjwiSJVo4t4ZEIjVZUznjWqbQE 。。。。。 。。。。 还会得到两个文件,在git bash打开的文件夹中 复制公钥 在刚刚的git bash中 $ clip < ~ / . ssh / id_rsa . pub 设置sshkey 打开自己的github主页 点击最右上角的头像下的settings

SSH配置Linux免密登录

偶尔善良 提交于 2020-03-04 16:26:20
有一台Linux服务器,当我在本地的电脑上通过git上传代码到这台Linux服务器时,希望实现免密登录,就需要用到SSH秘钥, 首先,你需要确认自己是否已经拥有密钥。 默认情况下,用户的 SSH 密钥存储在其 ~/.ssh 目录下,打开git,输入命令: $ cd ~/.ssh $ ls id_dsa id_dsa.pub known_hosts 其中 id_dsa 是私钥, id_dsa .pub 是你的公钥,如果找不到这样的文件(或者根本没有 .ssh 目录),你可以通过运行 ssh-keygen 程序来创建它们: $ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/schacon/.ssh/id_rsa): Created directory '/home/schacon/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/schacon/.ssh/id_rsa. Your public key has been saved in /home

348 git远程仓库:gitee(码云)与git,git clone,git push,git pull,git remote,SSH免密码登陆及配置,

旧城冷巷雨未停 提交于 2020-03-04 10:45:21
gitee(码云)与git git与gitee没有直接的关系。 git是一个版本控制工具。 码云 是一个代码托管平台,开源社区,是git的一个远程代码仓库。 //1. gitee是一个面向开源及私有软件项目的托管平台,因为只支持git 作为唯一的版本库格式进行托管,故名gitHub。 //2. gitee免费,代码所有人都能看到,但是只有你自己能修改。 gitee官网 开源中国-git git clone 作用:克隆远程仓库的代码到本地 git clone [远程仓库地址] git clone git://gitee.com/jepsongithub/test.git 会在本地新建一个 test 文件夹,在test中包含了一个 .git 目录,用于保存所有的版本记录,同时test文件中还有最新的代码,你可以直接进行后续的开发和使用。 git克隆默认会使用远程仓库的项目名字,也可以自己指定。需要是使用以下命令: git clone [远程仓库地址] [本地项目名] git push 作用:将本地仓库中代码提交到远程仓库 git push 仓库地址 master :将代码提交到远程仓库 例子: git push git@gitee.com:jepsongithub/test.git master ,如果第一次使用,需要填写gitee的用户名和密码 完整语法: git push