客户端想要远程访问Linux主机A
打开终端,ssh [用户名]@[访问主机ip ]
ssh xia@172.26.14.193
将会创建ssh连接,要求输入对应登录用户密码
The authenticity of host '172.26.14.193 (172.26.14.193)' can't be established.
ECDSA key fingerprint is SHA256:kyPK1XP0I9w/LbaI0fsvCcREY8Bm3ZabEf9XP6dpQKc.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.26.14.193' (ECDSA) to the list of known hosts.
xia@172.26.14.193's password:
输入密码就能完成登录,就能看到如下信息 (上次登录信息及当前登录用户)
Activate the web console with: systemctl enable --now cockpit.socket
Last failed login: Mon Jun 21 03:36:34 EDT 2021 from 172.26.15.188 on ssh:notty
There was 1 failed login attempt since the last successful login.
Last login: Mon Jun 21 02:19:49 2021
[xia@localhost ~]$
从客户端上传文件到远程主机 使用scp命令
scp [源文件] [用户名]@[ip地址]:[远端文件目录地址]
scp /Users/lycoris/Downloads/mongodb-linux-x86_64-rhel80-4.4.6.tgz root@172.26.14.193:/usr/local/mongodb
把远程服务器文件拷贝到本地
scp root@172.26.14.193:/usr/local/mongodb/mongodb-linux-x86_64-rhel80-4.4.6.tgz /Users/lycoris/Downloads/aaa.tgz