zoukankan      html  css  js  c++  java
  • 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 5555 /Applications/program/HTTP请求.jmx lilyadmin@xxx.xx.xx.xxx:/home/lilyadmin/
    HTTP请求.jmx                                100% 5093   203.4KB/s   00:00   

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

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

    scp -r -P 5555 /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 5555 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/1.txt
    OpenSSH_7.6p1, LibreSSL 2.6.2
    debug1: Reading configuration data /etc/ssh/ssh_config   #读取配置文件
    debug1: /etc/ssh/ssh_config line 20: Applying options for *
    debug1: Connecting to 106.xx.xxx.xxx port 5555.
    debug1: Connection established.
    debug1: identity file /Users/abc/.ssh/id_rsa type 0
    debug1: key_load_public: No such file or directory
    debug1: identity file /Users/abc/.ssh/id_rsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /Users/abc/.ssh/id_dsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /Users/abc/.ssh/id_dsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /Users/abc/.ssh/id_ecdsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /Users/abc/.ssh/id_ecdsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /Users/abc/.ssh/id_ed25519 type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /Users/abc/.ssh/id_ed25519-cert type -1
    debug1: Local version string SSH-2.0-OpenSSH_7.6
    debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
    debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000000
    debug1: Authenticating to 106.xxx.xx.xxx:5555 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-64@openssh.com compression: none
    debug1: kex: client->server cipher: aes128-ctr MAC: umac-64@openssh.com compression: none
    debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<3072<8192) 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:1
    debug1: rekey after 4294967296 blocks
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug1: SSH2_MSG_NEWKEYS received
    debug1: rekey after 4294967296 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 279
    debug1: Authentication succeeded (publickey).
    Authenticated to 106.xx.xx.xxx ([106.xx.xx.xxx]:5555).
    debug1: channel 0: 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-8
    debug1: Sending command: scp -v -f /home/lilyadmin/1.txt
    Sending file modes: C0644 0 1.txt
    Sink: C0644 0 1.txt
    1.txt                                         100%    0     0.0KB/s   00:00    
    debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
    debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
    debug1: channel 0: free: client-session, nchannels 1
    debug1: fd 0 clearing O_NONBLOCK
    debug1: fd 1 clearing O_NONBLOCK
    Transferred: sent 3240, received 2944 bytes, in 0.1 seconds
    Bytes per second: sent 50227.8, received 45639.1
    debug1: Exit status 0
  • 相关阅读:
    报表容器元素的典型用途:保持位置关系+表角斜线
    如何在Wyn仪表板中实现文件下载
    报表表格中的迷你图
    怎么实现固定行数的表格类报表
    如何把自己设计好的仪表板分享给别人?
    报表中的【子弹图】实现方法
    来自不同数据集的图表如何设置联动
    仪表板图表条件格式化设置
    报表中的数据格式设置方法汇总
    仪表板数据表根据用户需求可以自由选择查看的数据列
  • 原文地址:https://www.cnblogs.com/lily1989/p/8547743.html
Copyright © 2011-2022 走看看