1、先按照文档在本地生成SSHkey

2、mac输入 sudo -i 进入超级管理员#模式下,然后

创建用户
#useradd XXXadmin
#passwd XXXadmin

XXXadmin用户增加授权key
cd /home/XXXadmin/
mkdir .ssh
chmod 700 ~/.ssh
把本地的key :XXXadmin.pub上传到 .ssh 下 并重命名为:authorized_keys
chmod 600 authorized_keys

修改用户组
chown -R XXXadmin:XXXadmin ./.ssh

编辑ssh 配置文件
vi /etc/ssh/sshd_config
去掉下面三行注释
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
修改
Port 5555
PermitRootLogin no
PasswordAuthentication no //禁止使用密码登录
service sshd restart

~~~~~~~~上传文件到服务器,下载服务器文件到本地~~~~~~

1.本文主要是采用scp 来进行复制

abc@abcs-Mac:~$ scp -h
scp: illegal option -- h
usage: scp [-346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
[-l limit] [-o ssh_option] [-P port] [-S program]
[[user@]host1:]file1 ... [[user@]host2:]file2

OPTIONS:

-v 和大多数 linux命令中的-v意思一样,用来显示进度。可以用来查看连接、认证、或是配置错误

-C 使能压缩选项

-P 选择端口

-r 复制目录

1、从本地将文件传输到服务器

scp【本地文件的路径】【服务器用户名】@【服务器地址】:【服务器上存放文件的路径】

abc@abcs-Mac:~$ scp -P  /Applications/program/HTTP请求.jmx lilyadmin@xxx.xx.xx.xxx:/home/lilyadmin/
HTTP请求.jmx % .4KB/s :

2、从本地将文件夹传输到服务器

scp -r【本地文件的路径】【服务器用户名】@【服务器地址】:【服务器上存放文件的路径】

scp -r -P  /Applications/program/test11 lilyadmin@106.xxx.xx.xxx:/home/lilyadmin/

3、将服务器上的文件传输到本地

scp 【服务器用户名】@【服务器地址】:【服务器上存放文件的路径】【本地文件的路径】

 scp -v -P 5555 lilyadmin@xxx.xx.xx.xxx:/home/lilyadmin/1.txt /Users/abc/

4、将服务器上的文件夹传输到本地

scp -r 【服务器用户名】@【服务器地址】:【服务器上存放文件的路径】【本地文件的路径】

 scp -r -v -P  lilyadmin@xxx.xx.xx.xxx:/home/lilyadmin/test /Users/abc/
Executing: program /usr/bin/ssh host 106.xxx.xx.xxx, user lilyadmin, command scp -v -f /home/lilyadmin/.txt
OpenSSH_7.6p1, LibreSSL 2.6.
debug1: Reading configuration data /etc/ssh/ssh_config #读取配置文件
debug1: /etc/ssh/ssh_config line : Applying options for *
debug1: Connecting to 106.xx.xxx.xxx port .
debug1: Connection established.
debug1: identity file /Users/abc/.ssh/id_rsa type
debug1: key_load_public: No such file or directory
debug1: identity file /Users/abc/.ssh/id_rsa-cert type -
debug1: key_load_public: No such file or directory
debug1: identity file /Users/abc/.ssh/id_dsa type -
debug1: key_load_public: No such file or directory
debug1: identity file /Users/abc/.ssh/id_dsa-cert type -
debug1: key_load_public: No such file or directory
debug1: identity file /Users/abc/.ssh/id_ecdsa type -
debug1: key_load_public: No such file or directory
debug1: identity file /Users/abc/.ssh/id_ecdsa-cert type -
debug1: key_load_public: No such file or directory
debug1: identity file /Users/abc/.ssh/id_ed25519 type -
debug1: key_load_public: No such file or directory
debug1: identity file /Users/abc/.ssh/id_ed25519-cert type -
debug1: Local version string SSH-2.0-OpenSSH_7.
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.
debug1: match: OpenSSH_5. pat OpenSSH_5* compat 0x0c000000
debug1: Authenticating to 106.xxx.xx.xxx: as 'lilyadmin'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: diffie-hellman-group-exchange-sha256
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: umac-@openssh.com compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: umac-@openssh.com compression: none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(<<) sent
debug1: got SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: got SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: ssh-rsa SHA256:2qZOXDtbDTclZAu6pdw/WMa8Xd0T/9LI+/beV7sR92U
debug1: Host '[106.xx.xx.xxx]:5555' is known and matches the RSA host key.
debug1: Found key in /Users/abc/.ssh/known_hosts:
debug1: rekey after blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after blocks
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:+crvOvxCiUncwpe2N5atQJAeCJgqeomHV1H0QVKgJGc /Users/abc/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen
debug1: Authentication succeeded (publickey).
Authenticated to 106.xx.xx.xxx ([106.xx.xx.xxx]:).
debug1: channel : new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LANG = zh_CN.UTF-
debug1: Sending command: scp -v -f /home/lilyadmin/.txt
Sending file modes: C0644 .txt
Sink: C0644 .txt
.txt % .0KB/s :
debug1: client_input_channel_req: channel rtype exit-status reply
debug1: client_input_channel_req: channel rtype eow@openssh.com reply
debug1: channel : free: client-session, nchannels
debug1: fd clearing O_NONBLOCK
debug1: fd clearing O_NONBLOCK
Transferred: sent , received bytes, in 0.1 seconds
Bytes per second: sent 50227.8, received 45639.1
debug1: Exit status

mac 下配置连接Linux服务器方法,上传下载文件操作的更多相关文章

  1. paramiko远程连接linux服务器进行上传下载文件

    花了不少时间来研究paramiko中sftpclient的文件传输,一顿操作猛如虎,最后就一直卡在了路径报错问题,疯狂查阅资料借鉴大佬们的心得,还是搞不好,睡了个午觉醒来,仔细一看原来是指定路径的文件 ...

  2. Mac下如何连接linux服务器(SSH)-比较好用的SSH工具推荐

    Mac下如何连接linux服务器(SSH) 1.用mac自带终端连接 步骤如下: 打开终端,在顶部shell菜单中选择新建远程连接 在右侧服务器窗口点击+号,添加服务器,输入IP等信息 输入用户名,点 ...

  3. linux使用命令上传下载文件 -- lrzsz

    之前都是用Xftp工具在本地和linux系统之间上传下载文件,最近觉得麻烦,因为平时用Xshell连接,要传输文件的时候还要额外使用别的工具,下面是lrzsz的安装和简单的使用过程: 详细的使用可以s ...

  4. 远程登录Linux系统及上传下载文件

    目录 1. 远程登录Linux系统 1.1 为什么要远程登录 1.2 Xshell6安装 1.3 连接登录 1.3.1 连接前提 1.3.2 Xshell连接配置 2. 远程上传下载文件 2.1 Xf ...

  5. mac通过自带的ssh连接Linux服务器并上传解压文件

    需求: 1:mac连接linux服务器 2:将mac上的文件上传到linux服务器指定位置 3:解压文件 mac上使用命令,推荐使用 iterm2 .当然,也可以使用mac自带的终端工具. 操作过程: ...

  6. Mac 远程连接Linux服务器及上传、下载命令

    1.使用ssh命令连接远程服务器主机 1.不设置端口,默认就是22 ssh root@192.168.18.129 1.1.设置端口例: ssh -p 22 root@192.168.18.1292. ...

  7. 批量执行(Linux命令,上传/下载文件)

    前言: 每个公司的网络环境大都划分 办公网络.线上网络,之所以划分的主要原因是为了保证线上操作安全: 对于外部用户而言也只能访问线上网络的特定开放端口,那么是什么控制了用户访问线上网络的呢? 防火墙过 ...

  8. deepin,linux服务器,上传下载

    ------------恢复内容开始------------ 物理机:deepin系统15.11桌面版 服务器:centos7 一.ftp连接服务器 1. deepin默认没有安装命令行的ftp客户端 ...

  9. Linux与本地上传下载文件

    当出于安全原因,客户的服务器不允许使用windows第三方插件连接的时候,本地windows跟远程的linux服务器进行文件的上下传受到了限制,此时可以在linux服务器上安装一个工具:lrzsz.安 ...

随机推荐

  1. day13. 迭代器与高阶函数

    一.迭代器 """ 能被next调用,并不断返回下一个值的对象,叫做迭代器(对象) 概念: 迭代器指的是迭代取值的工具,迭代是一个重复的过程,每次重复都是基于上一次的结果 ...

  2. 2 DC电参数测试 (1)

    基本常识: (1)Hot switch好的程序应避免使用热切换(这里热的含义类似于热插拔的“热“),热切换是指带点操作,有电流的情况下断开开关或闭合开关的瞬间,有电流通过,这会减少开关的寿命甚至直接损 ...

  3. 解放双手!用 Python 控制你的鼠标和键盘

    在工作中难免遇到需要在电脑上做一些重复的点击或者提交表单等操作,如果能通过 Python 预先写好相关的操作指令,让它帮你操作,然后你自己去刷网页打游戏,岂不是很爽?] 很多人学习python,不知道 ...

  4. 微信小程序 progress 进度条 内部圆角及内部条渐变色

    微信小程序progress进度条内部圆角及渐变色 <view class="progress-box"> <progress percent="80&q ...

  5. ElasticSearch 7.X版本19个常用的查询语句

    整理一篇常用的CRUD查询语句,之前这篇文件是在17年左右发表的,从英文翻译过来,现在采用7.x 版本进行实验,弃用的功能或者参数,我这边会进行更新,一起来学习吧. 为了演示不同类型的 Elastic ...

  6. HTML基础-04

    定位 定位:通过定位可以将元素摆放在页面中任意位置 语法:position属性设置元素的定位 可选值:static:默认值,开启定位 relative开启相对定位 absolute开启绝对定位 fix ...

  7. SpringMVC常见问题Error configuring application listener of class org.springframework.web.context.ContextLoaderListenejava.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    六月 20, 2018 9:43:34 下午 org.apache.catalina.core.StandardContext listenerStart 严重: Error configuring ...

  8. 机器学习 | 详解GBDT在分类场景中的应用原理与公式推导

    本文始发于个人公众号:TechFlow,原创不易,求个关注 今天是机器学习专题的第31篇文章,我们一起继续来聊聊GBDT模型. 在上一篇文章当中,我们学习了GBDT这个模型在回归问题当中的原理.GBD ...

  9. eric4 打包文件

    在.py 工程 所在目录: 按住shift,鼠标右键,在此处打开cmd或shell,然后如下操作 1.打包成文件夹 pyinstaller lrs.py 2.打包成 单文件 pyinstaller - ...

  10. python:**kwargs

    **kwargs接收键值对参数,即字典, dict的pop()函数内需传2个参数,第一个参数为dict内的key, 如果有该key>第二个参数为None,最后的结果就是该key对应的value. ...