日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

mac 下配置连接Linux服务器方法,上传下载文件操作

發布時間:2024/4/17 linux 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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意思一樣,用來顯示進度??梢杂脕聿榭催B接、認證、或是配置錯誤

-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

?

轉載于:https://www.cnblogs.com/lily1989/p/8547743.html

總結

以上是生活随笔為你收集整理的mac 下配置连接Linux服务器方法,上传下载文件操作的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。