mac 下配置连接Linux服务器方法,上传下载文件操作
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服务器方法,上传下载文件操作的更多相关文章
- paramiko远程连接linux服务器进行上传下载文件
花了不少时间来研究paramiko中sftpclient的文件传输,一顿操作猛如虎,最后就一直卡在了路径报错问题,疯狂查阅资料借鉴大佬们的心得,还是搞不好,睡了个午觉醒来,仔细一看原来是指定路径的文件 ...
- Mac下如何连接linux服务器(SSH)-比较好用的SSH工具推荐
Mac下如何连接linux服务器(SSH) 1.用mac自带终端连接 步骤如下: 打开终端,在顶部shell菜单中选择新建远程连接 在右侧服务器窗口点击+号,添加服务器,输入IP等信息 输入用户名,点 ...
- linux使用命令上传下载文件 -- lrzsz
之前都是用Xftp工具在本地和linux系统之间上传下载文件,最近觉得麻烦,因为平时用Xshell连接,要传输文件的时候还要额外使用别的工具,下面是lrzsz的安装和简单的使用过程: 详细的使用可以s ...
- 远程登录Linux系统及上传下载文件
目录 1. 远程登录Linux系统 1.1 为什么要远程登录 1.2 Xshell6安装 1.3 连接登录 1.3.1 连接前提 1.3.2 Xshell连接配置 2. 远程上传下载文件 2.1 Xf ...
- mac通过自带的ssh连接Linux服务器并上传解压文件
需求: 1:mac连接linux服务器 2:将mac上的文件上传到linux服务器指定位置 3:解压文件 mac上使用命令,推荐使用 iterm2 .当然,也可以使用mac自带的终端工具. 操作过程: ...
- Mac 远程连接Linux服务器及上传、下载命令
1.使用ssh命令连接远程服务器主机 1.不设置端口,默认就是22 ssh root@192.168.18.129 1.1.设置端口例: ssh -p 22 root@192.168.18.1292. ...
- 批量执行(Linux命令,上传/下载文件)
前言: 每个公司的网络环境大都划分 办公网络.线上网络,之所以划分的主要原因是为了保证线上操作安全: 对于外部用户而言也只能访问线上网络的特定开放端口,那么是什么控制了用户访问线上网络的呢? 防火墙过 ...
- deepin,linux服务器,上传下载
------------恢复内容开始------------ 物理机:deepin系统15.11桌面版 服务器:centos7 一.ftp连接服务器 1. deepin默认没有安装命令行的ftp客户端 ...
- Linux与本地上传下载文件
当出于安全原因,客户的服务器不允许使用windows第三方插件连接的时候,本地windows跟远程的linux服务器进行文件的上下传受到了限制,此时可以在linux服务器上安装一个工具:lrzsz.安 ...
随机推荐
- 7月15日考试 题解(链表+状压DP+思维题)
前言:蒟蒻太弱了,全打的暴力QAQ. --------------------- T1 小Z的求和 题目大意:求$\sum\limits_{i=1}^n \sum\limits_{j=i}^n kth ...
- ios textView跟随键盘的移动
实现效果: textview 能够跟随键盘的移动而移动 效果图如下: 下边贴上主要的代码: 1.创建textview @interface ViewController ()<UITextVie ...
- win7(64位)使用DEBUG
win7 64位好像是不能直接打开DOS进行DEUBG的,于是查找相应解决方案 开始看其他人的帖子,写得语焉不详,后来一查,居然是抄百度的.....自己不觉得low吗... 参考百度经验的回答http ...
- syslog协议及rsyslog服务全解析
背景:需求来自于一个客户想将服务器的日志转发到自己的日志服务器上,所以希望我们能提供这个转发的功能,同时还要满足syslog协议. 一.什么是syslog协议 1.介绍(略) 2.syslog标准协议 ...
- c语言学习笔记之结构体存储
今天讲讲结构体存储问题 首先,结构体简单说是对不同类型的封装,一开始我们可能会想结构体在内存中的存储的大小是直接元素的和 例如 我们可能会觉得是 结构体大小=int(4个字节)+ short(2个字节 ...
- 经典的IPC问题
Inter-Process Communication的缩写,含义是进程间通信,是指两个进程间交换数据的过程. 哲学家进餐问题 概述 哲学家进餐/思考 进餐需要两把叉子 每次拿一把叉子 如何预防死锁 ...
- 基于OpenSIPS做注册服务下,场景A打B,一方发起BYE挂断后收到500,另一方无法挂断的问题
基于OpenSIPS做注册服务下,场景A打B,一方发起BYE挂断后收到500,另一方无法挂断的问题 最近在工作中遇到一个看似很奇怪的,排除起来很费劲,但最后的解决方式又及其简单的问题,下面我们 ...
- 03-java实现循环链表
03java实现循环链表 本人git https://github.com/bigeyes-debug/Algorithm 一丶单向循环链表 就是为尾节点指向头结点 二丶单向循环链表的接口设计 比较单 ...
- Azure Application Gateway(一)对后端 Web App 进行负载均衡
一,引言 今天,我们学习一个新的知识点-----Azure Application Gateway,通过Azure 应用程序网关为我么后端的服务提供负载均衡的功能.我们再文章头中大概先了解一下什么是应 ...
- C#LeetCode刷题之#720-词典中最长的单词(Longest Word in Dictionary)
问题 该文章的最新版本已迁移至个人博客[比特飞],单击链接 https://www.byteflying.com/archives/4120 访问. 给出一个字符串数组words组成的一本英语词典.从 ...