這篇文章主要為大家詳細(xì)介紹了linux的遠(yuǎn)程訪問及控制,文中示例代碼介紹的非常詳細(xì),零基礎(chǔ)也能參考此文章,感興趣的小伙伴們可以參考一下。
創(chuàng)新互聯(lián)擁有10多年的建站服務(wù)經(jīng)驗(yàn),在此期間,我們發(fā)現(xiàn)較多的客戶在挑選建站服務(wù)商前都非常的猶豫。主要問題集中:在無法預(yù)知自己的網(wǎng)站呈現(xiàn)的效果是什么樣的?也無法判斷選擇的服務(wù)商設(shè)計(jì)出來的網(wǎng)頁效果自己是否會(huì)滿意?創(chuàng)新互聯(lián)業(yè)務(wù)涵蓋了互聯(lián)網(wǎng)平臺(tái)網(wǎng)站建設(shè)、移動(dòng)平臺(tái)網(wǎng)站制作、網(wǎng)絡(luò)推廣、按需設(shè)計(jì)網(wǎng)站等服務(wù)。創(chuàng)新互聯(lián)網(wǎng)站開發(fā)公司本著不拘一格的網(wǎng)站視覺設(shè)計(jì)和網(wǎng)站開發(fā)技術(shù)相結(jié)合,為企業(yè)做網(wǎng)站提供成熟的網(wǎng)站設(shè)計(jì)方案。linux運(yùn)維管理的時(shí)候,一般都是通過遠(yuǎn)程方式管理,當(dāng)需要從一個(gè)工作站管理數(shù)以百計(jì)的服務(wù)器主機(jī)時(shí),遠(yuǎn)程維護(hù)的方式將更占優(yōu)勢。
OpenSSH
#Port 22 //端口號(hào)
#AddressFamily any
#ListenAddress 0.0.0.0 //ipv4監(jiān)聽地址
#ListenAddress :: //ipv6監(jiān)聽地址
#LoginGraceTime 2m //會(huì)話時(shí)間
#PermitRootLogin yes //是否進(jìn)制root登錄
#StrictModes yes //是否驗(yàn)證訪問權(quán)限
#MaxAuthTries 6 //驗(yàn)證次數(shù)6次
#MaxSessions 10 //訪問的大鏈接數(shù)
#PubkeyAuthentication yes //是否驗(yàn)證公鑰
[root@tast01 ~]# vim /etc/ssh/sshd_config //進(jìn)入編輯服務(wù)器配置文件信息
Port 22 //開啟端口
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
:wq //保存退出
[root@tast01 ~]# systemctl restart sshd //重啟SSH服務(wù)
[root@tast02 ~]# ssh root@192.168.144.133 //使用SSH服務(wù)登錄tast01服務(wù)器
The authenticity of host '192.168.144.133 (192.168.144.133)' can't be established.
ECDSA key fingerprint is SHA256:B8IsZOFG7FbtVkIK+dMILmo0iA4OEIeVGY0GnnCbXhk.
ECDSA key fingerprint is MD5:c2:d8:09:17:de:6e:ec:07:06:1b:ac:b6:1e:bd:62:09.
Are you sure you want to continue connecting (yes/no)? yes //詢問是否建立會(huì)話
Warning: Permanently added '192.168.144.133' (ECDSA) to the list of known hosts.
root@192.168.144.133's password: //輸入密碼
Last login: Mon Sep 9 13:59:09 2019
[root@tast01 ~]# //成功登錄tast01
[root@tast01 ~]# exit //退出
登出
Connection to 192.168.144.133 closed.
[root@tast02 ~]# //回到tast02端口
[root@tast01 ~]# vim /etc/ssh/sshd_config //進(jìn)入編輯主配置文件
#LoginGraceTime 2m
PermitRootLogin no //開啟是否啟用禁用root登錄,更改yes為no,禁止root用戶登錄
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
:wq //保存退出
[root@tast01 ~]# systemctl restart sshd //重啟服務(wù)
[root@tast01 ~]# useradd siti //創(chuàng)建siti普通用戶
[root@tast01 ~]# passwd siti //設(shè)置用戶密碼
更改用戶 siti 的密碼 。
新的 密碼:
無效的密碼: 密碼少于 8 個(gè)字符
重新輸入新的 密碼:
passwd:所有的身份驗(yàn)證令牌已經(jīng)成功更新。
[root@tast01 ~]# id siti //查看新建用戶siti信息
uid=1001(siti) gid=1001(siti) 組=1001(siti)
[root@tast01 ~]# id sun //查看用戶sun信息
uid=1000(sun) gid=1000(sun) 組=1000(sun),10(wheel)
[root@tast02 ~]# ssh root@192.168.144.133 //使用SSH服務(wù)登錄tast01服務(wù)器root用戶
root@192.168.144.133's password: //輸入密碼登錄
Permission denied, please try again. //拒絕登錄root
root@192.168.144.133's password:
Permission denied, please try again.
root@192.168.144.133's password:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). //嘗試輸入密碼三次后彈出,拒絕登錄
[root@tast02 ~]# ssh siti@192.168.144.133 //使用SSH服務(wù)登錄siti用戶
siti@192.168.144.133's password:
[siti@tast01 ~]$ //成功登錄tast01服務(wù)器siti用戶
[siti@tast01 ~]$ su - root //再siti用戶下使用su切換root用戶
]密碼: //輸入密碼
上一次登錄:一 9月 9 15:16:00 CST 2019從 192.168.144.135pts/1 上
最后一次失敗的登錄:一 9月 9 15:33:03 CST 2019從 192.168.144.135ssh:notty 上
最有一次成功登錄后有 3 次失敗的登錄嘗試。
[root@tast01 ~]# //成功登錄root用戶。
[root@tast01 ~]# exit //退出
登出
[siti@tast01 ~]$ exit //退出
登出
Connection to 192.168.144.133 closed.
[root@tast02 ~]# //回到tast02用戶
[root@tast01 ~]# vim /etc/pam.d/su //進(jìn)入編輯pam配置文件
#%PAM-1.0
auth sufficient pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth sufficient pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
auth required pam_wheel.so use_uid //開啟pam認(rèn)證
auth substack system-auth
auth include postlogin
account sufficient pam_succeed_if.so uid = 0 use_uid quiet
account include system-auth
password include system-auth
session include system-auth
session include postlogin
session optional pam_xauth.so
~
~
~
:wq //保存退出
[root@tast02 ~]# ssh siti@192.168.144.133 //登錄siti用戶
siti@192.168.144.133's password: //輸入密碼
Last failed login: Mon Sep 9 16:09:32 CST 2019 from 192.168.144.135 on ssh:notty
There was 1 failed login attempt since the last successful login.
Last login: Mon Sep 9 15:47:20 2019 from 192.168.144.135
[siti@tast01 ~]$ su - root //登錄siti用戶,并切換root用戶
密碼: //輸入密碼
su: 拒絕權(quán)限 //權(quán)限拒絕,無法切換
[siti@tast01 ~]$
[siti@tast01 ~]$ su - sun //切換sun用戶
密碼: //輸入密碼
su: 拒絕權(quán)限 //權(quán)限拒絕,無法切換
[siti@tast01 ~]$
[root@tast01 ~]# vim /etc/ssh/sshd_config //進(jìn)入服務(wù)器配置文件
#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
MaxAuthTries 6 //開啟密碼驗(yàn)證次數(shù)
#MaxSessions 10
:wq //保存退出
[root@tast02 ~]# ssh sun@192.168.144.133 //登錄sun用戶
sun@192.168.144.133's password: //輸入錯(cuò)誤密碼
Permission denied, please try again. //1次輸錯(cuò),拒絕登錄
sun@192.168.144.133's password: //輸入錯(cuò)誤密碼
Permission denied, please try again. //2次輸錯(cuò),拒絕登錄
sun@192.168.144.133's password: //輸入錯(cuò)誤密碼
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). //3次輸入錯(cuò)誤直接登出
[root@tast02 ~]# ssh -o NumberofPasswordPrompts=8 sun@192.168.144.133 //使用命令提高密碼輸入次數(shù)
sun@192.168.144.133's password:
Permission denied, please try again.
sun@192.168.144.133's password:
Permission denied, please try again.
sun@192.168.144.133's password:
Permission denied, please try again.
sun@192.168.144.133's password:
Permission denied, please try again.
sun@192.168.144.133's password:
Permission denied, please try again.
sun@192.168.144.133's password:
Received disconnect from 192.168.144.133 port 22:2: Too many authentication failures
Authentication failed. //輸入密碼6次后彈出,設(shè)設(shè)置生效
[root@tast01 ~]# vim /etc/ssh/sshd_config //進(jìn)入編輯ssh服務(wù)端配置文件
#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
MaxAuthTries 6
#MaxSessions 10
AllowUsers sun@192.168.144.135 stii //在此處添加條目,僅允許IP地址為192.168.144.135客戶機(jī)登錄sun用戶
僅允許客戶端登錄stii用戶
#PubkeyAuthentication yes
:wq //保存退出
[root@tast01 ~]# useradd stii //添加stii用戶
[root@tast01 ~]# passwd stii //設(shè)置stii用戶密碼
更改用戶 stii 的密碼 。
新的 密碼:
無效的密碼: 密碼少于 8 個(gè)字符
重新輸入新的 密碼:
passwd:所有的身份驗(yàn)證令牌已經(jīng)成功更新。
[root@tast01 ~]# systemctl restart sshd //重啟ssh服務(wù)
[root@tast02 ~]# ssh sun@192.168.144.133 //在tast02客戶端中登錄服務(wù)器sun用戶
sun@192.168.144.133's password: //輸入密碼
Last failed login: Mon Sep 9 17:24:32 CST 2019 from 192.168.144.135 on ssh:notty
There were 6 failed login attempts since the last successful login.
Last login: Mon Sep 9 17:21:47 2019 from 192.168.144.133
[sun@tast01 ~]$ //成功登錄
[sun@tast01 ~]$ exit //退出用戶
登出
Connection to 192.168.144.133 closed.
[root@tast02 ~]# ssh siti@192.168.144.133 //使用ssh登錄服務(wù)器siti用戶
siti@192.168.144.133's password: //輸入密碼
Permission denied, please try again. //拒絕登錄
[root@tast02 ~]# ssh stii@192.168.144.133 //登錄stii用戶
stii@192.168.144.133's password: //輸入密碼
[stii@tast01 ~]$ //成功登錄
[root@tast03 ~]# ssh sun@192.168.144.133 //tast03客戶機(jī)使用ssh服務(wù)登錄服務(wù)器sun用戶
The authenticity of host '192.168.144.133 (192.168.144.133)' can't be established.
ECDSA key fingerprint is SHA256:B8IsZOFG7FbtVkIK+dMILmo0iA4OEIeVGY0GnnCbXhk.
ECDSA key fingerprint is MD5:c2:d8:09:17:de:6e:ec:07:06:1b:ac:b6:1e:bd:62:09.
Are you sure you want to continue connecting (yes/no)? yes //詢問是否建立會(huì)話,輸入yes確定建立會(huì)話
Warning: Permanently added '192.168.144.133' (ECDSA) to the list of known hosts.
sun@192.168.144.133's password: //輸入密碼
Permission denied, please try again. //拒絕登錄
[root@tast03 ~]# ssh siti@192.168.144.133 //tast03客戶機(jī)使用ssh服務(wù)登錄服務(wù)器siti用戶
siti@192.168.144.133's password: //輸入密碼
Permission denied, please try again. //拒絕登錄
[root@tast03 ~]# ssh stii@192.168.144.133 //tast03客戶機(jī)使用ssh服務(wù)登錄服務(wù)器stii用戶
stii@192.168.144.133's password: //輸入密碼
Last login: Mon Sep 9 21:55:49 2019 from 192.168.144.135
[stii@tast01 ~]$ //成功登錄
[root@tast01 ~]# vim /etc/ssh/sshd_config //編輯ssh服務(wù)器配置文件
#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
MaxAuthTries 6
#MaxSessions 10
DenyUsers sun@192.168.144.135 stii //刪除僅允許條目,添加拒絕條目
#PubkeyAuthentication yes
:wq //保存退出
[root@tast01 ~]# systemctl restart sshd //重啟ssh服務(wù)
[root@tast02 ~]# ssh sun@192.168.144.133 //在tast02客戶端中登錄服務(wù)器sun用戶
sun@192.168.144.133's password: //輸入密碼
Permission denied, please try again. //拒絕登錄
[root@tast02 ~]# ssh stii@192.168.144.133 //在tast02客戶端中登錄服務(wù)器stii用戶
stii@192.168.144.133's password: //輸入密碼
Permission denied, please try again. //拒絕登錄
[root@tast02 ~]# ssh siti@192.168.144.133 //在tast02客戶端中登錄服務(wù)器siti用戶
siti@192.168.144.133's password: //輸入密碼
Last failed login: Mon Sep 9 22:02:00 CST 2019 from 192.168.144.132 on ssh:notty
There were 2 failed login attempts since the last successful login.
Last login: Mon Sep 9 21:53:53 2019 from 192.168.144.135
[siti@tast01 ~]$ //成功登錄
[root@tast03 ~]# ssh stii@192.168.144.133 //tast03客戶機(jī)使用ssh服務(wù)登錄服務(wù)器stii用戶
stii@192.168.144.133's password: //輸入密碼
Permission denied, please try again. //拒絕登錄
[root@tast03 ~]# ssh sun@192.168.144.133 //tast03客戶機(jī)使用ssh服務(wù)登錄服務(wù)器sun用戶
sun@192.168.144.133's password: //輸入密碼
Last failed login: Mon Sep 9 22:30:55 CST 2019 from 192.168.144.135 on ssh:notty
There was 1 failed login attempt since the last successful login.
Last login: Mon Sep 9 22:24:51 2019 from 192.168.144.133
[sun@tast01 ~]$ //成功登錄
[root@tast03 ~]# ssh siti@192.168.144.133 //tast03客戶機(jī)使用ssh服務(wù)登錄服務(wù)器siti用戶
siti@192.168.144.133's password: //輸入密碼
Last login: Mon Sep 9 22:32:16 2019 from 192.168.144.135
[siti@tast01 ~]$ //成功登錄
[root@tast01 ~]# vim /etc/ssh/sshd_config //編輯ssh配置文件
#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
MaxAuthTries 6
#MaxSessions 10
DenyUsers sun@192.168.144.135 stii
PubkeyAuthentication yes //開啟密鑰對(duì)驗(yàn)證功能
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile .ssh/authorized_keys //密鑰存放位置
:wq //保存退出
[root@tast02 ~]# useradd siaa //在tast02客戶機(jī)中創(chuàng)建用戶
[root@tast02 ~]# passwd siaa //設(shè)置用戶目錄
更改用戶 siaa 的密碼 。
新的 密碼:
無效的密碼: 密碼少于 8 個(gè)字符
重新輸入新的 密碼:
passwd:所有的身份驗(yàn)證令牌已經(jīng)成功更新。
[root@tast02 ~]# su - siaa //切換至用戶siaa
[siaa@tast02 ~]$ ssh-keygen -t ecdsa //制作ecdsa類型密鑰
Generating public/private ecdsa key pair.
Enter file in which to save the key (/home/siaa/.ssh/id_ecdsa): //密鑰存放位置,保持不變,直接回車
Created directory '/home/siaa/.ssh'.
Enter passphrase (empty for no passphrase): //輸入要設(shè)置的密碼
Enter same passphrase again: //再次輸入密碼
Your identification has been saved in /home/siaa/.ssh/id_ecdsa.
Your public key has been saved in /home/siaa/.ssh/id_ecdsa.pub.
The key fingerprint is:
SHA256:5mTvLU19q7uUUXECnEmNldB3S4gUiNZdvm1zupFUf0Y siaa@tast02
The key's randomart image is:
+---[ECDSA 256]---+
| o +=B@+o.|
| o o o*.+o=|
| . ..oE|
| ++.| //生成ecdsa密鑰
| S +.+=|
| = . ..=+=|
| . .o o+..|
| ...o + |
| ...+= |
+----[SHA256]-----+
[siaa@tast02 ~]$ ls -a //查看用戶家目錄隱藏文件
. .. .bash_logout .bash_profile .bashrc .cache .config .mozilla .ssh
[siaa@tast02 ~]$ cd .ssh //進(jìn)入生成的.ssh目錄
[siaa@tast02 .ssh]$ ls //查看目錄內(nèi)容
id_ecdsa id_ecdsa.pub //生成的私鑰與公鑰文件
[siaa@tast02 .ssh]$ ssh-copy-id -i id_ecdsa.pub siti@192.168.144.133 //指定生成的公鑰文件推送到服務(wù)器siti用戶
/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "id_ecdsa.pub"
The authenticity of host '192.168.144.133 (192.168.144.133)' can't be established.
ECDSA key fingerprint is SHA256:B8IsZOFG7FbtVkIK+dMILmo0iA4OEIeVGY0GnnCbXhk.
ECDSA key fingerprint is MD5:c2:d8:09:17:de:6e:ec:07:06:1b:ac:b6:1e:bd:62:09.
Are you sure you want to continue connecting (yes/no)? yes //詢問是推送,輸入yes
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
siti@192.168.144.133's password: //輸入服務(wù)器siti用戶密碼
Number of key(s) added: 1 //成功添加文件
Now try logging into the machine, with: "ssh 'siti@192.168.144.133'"
and check to make sure that only the key(s) you wanted were added.
[siaa@tast02 .ssh]$ ls //查看目錄信息
id_ecdsa id_ecdsa.pub known_hosts //創(chuàng)建文件Known_hosts
[siaa@tast02 .ssh]$ vim known_hosts //查看文件信息
192.168.144.133 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBC6sBj5BEqQkEIXTdcRDCzDlQRfhaoaY7OvyWzxcNxt+n6ZjbA1PSYK2SeTW3MAhUZOry7T6gNDFL7YyfMfXOGo= //成功將ecdsa生成的密鑰推送給服務(wù)器
[root@tast01 ~]# cd /home/siti //進(jìn)入siti家目錄
[root@tast01 siti]# ls -a //查看隱藏文件
. .bash_history .bash_profile .cache .mozilla
.. .bash_logout .bashrc .config .ssh
[root@tast01 siti]# cd .ssh //進(jìn)入添加的.ssh目錄
[root@tast01 .ssh]# ls //查看信息
authorized_keys
[root@tast01 .ssh]# cat authorized_keys //查看信息內(nèi)容
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBD6B4elJHibp7lYDfogSfd7krTUPyKzvLHZNk75GTm1oibrA0aMirgtwxxfUEOi+9+ZGU2V0C3+zH6vQpjvvPoo= siaa@tast02 //siaa@tast02的ecdsa加密文件
[siaa@tast02 .ssh]$ whoami //使用命令查看當(dāng)前登錄用戶
siaa //確定當(dāng)前登錄用戶為siaa
[siaa@tast02 .ssh]$ ssh siti@192.168.144.133 //使用ssh服務(wù)登錄服務(wù)器siti用戶
Enter passphrase for key '/home/siaa/.ssh/id_ecdsa': //輸入設(shè)置的ecdsa密碼
Last login: Mon Sep 9 22:37:19 2019 from 192.168.144.132
[siti@tast01 ~]$ //成功登錄服務(wù)器siti用戶
[siti@tast01 ~]$ exit //退出當(dāng)前用戶
登出
Connection to 192.168.144.133 closed.
[siaa@tast02 .ssh]$ ssh-agent bash //回到tast02中siaa用戶,使用命令代理bash環(huán)境
[siaa@tast02 .ssh]$ ssh-add //使用命令添加驗(yàn)證密碼
Enter passphrase for /home/siaa/.ssh/id_ecdsa: //輸入驗(yàn)證密碼
Identity added: /home/siaa/.ssh/id_ecdsa (/home/siaa/.ssh/id_ecdsa) //成功添加密碼
[siaa@tast02 .ssh]$ ssh siti@192.168.144.133 //登錄服務(wù)器siti用戶
Last login: Mon Sep 9 23:31:28 2019 from 192.168.144.135
[siti@tast01 ~]$ //成功登錄,免密碼驗(yàn)證
[root@tast01 ~]# vim /etc/ssh/sshd_config
...//省略部分內(nèi)容...
# Authentication:
#LoginGraceTime 2m
PermitRootLogin yes //開啟登錄root用戶權(quán)限
#StrictModes yes
MaxAuthTries 6
#MaxSessions 10
PubkeyAuthentication yes
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
:wq //保存退出
[root@tast01 ~]# systemctl restart sshd //重啟SSH服務(wù)
[root@tast02 ~]# ssh root@192.168.144.133 //使用ssh服務(wù)登錄服務(wù)器root用戶
root@192.168.144.133's password: //輸入用戶密碼
Last login: Wed Sep 11 22:56:28 2019 from 192.168.144.135
[root@tast01 ~]# //成功登錄
[root@tast01 ~]# exit //退出
登出
Connection to 192.168.144.133 closed.
[root@tast02 ~]# cd /opt/ //進(jìn)入opt目錄
[root@tast02 opt]# ls //查看
rh
[root@tast02 opt]# echo "this is ssh-client" > ssh_client.txt //創(chuàng)建.txt文件
[root@tast02 opt]# mkdir -p tast/si11 //遞歸創(chuàng)建tast目錄并在tast目錄下創(chuàng)建si11目錄
[root@tast02 opt]# ls //查看
rh ssh_client.txt tast //成功創(chuàng)建文件與目錄
[root@tast02 opt]# scp ssh_client.txt root@192.168.144.133:/home/ //將創(chuàng)建的.txt文件推送到服務(wù)器root用戶home目錄下
root@192.168.144.133's password: //輸入密碼
ssh_client.txt 100% 19 6.0KB/s 00:00 //成功推送
[root@tast01 ~]# ls /home/ //查看home目錄下文件
ssh_client.txt sun //成功添加文件
[root@tast01 ~]# cat /home/ssh_client.txt //查看文件內(nèi)容
this is ssh-client //顯示文件內(nèi)容
[root@tast02 opt]# scp -r tast/ root@192.168.144.133:/home/ //推送文件夾
root@192.168.144.133's password: //輸入密碼
[root@tast02 opt]# //推送成功
[root@tast01 ~]# ls /home/ //查看home目錄
ssh_client.txt sun tast //顯示推送的文件夾
[root@tast01 ~]# ls /home/tast/ //查看文件夾內(nèi)容
si11 //顯示創(chuàng)建的si11目錄
[root@tast02 opt]# ls //查看信息
rh ssh_client.txt tast //顯示內(nèi)容
[root@tast02 opt]# rm -rf ssh_client.txt //刪除txt文件
[root@tast02 opt]# rm -rf tast/ //刪除文件夾
[root@tast02 opt]# ls //查看
rh //成功刪除
[root@tast02 opt]# sftp root@192.168.144.133 //使用sftp命令登錄tast01服務(wù)器root用戶
root@192.168.144.133's password: //輸入密碼
Connected to 192.168.144.133.
sftp> ls //成功登錄并查看目錄信息
anaconda-ks.cfg initial-setup-ks.cfg 下載 公共
圖片 文檔 桌面 模板 //此時(shí)在root用戶家目錄下
視頻 音樂
sftp> cd /home/ //進(jìn)入home目錄
sftp> ls //查看
ssh_client.txt sun tast //顯示內(nèi)容
sftp> get ssh_client.txt //使用get命令下載txt文件
Fetching /home/ssh_client.txt to ssh_client.txt
/home/ssh_client.txt 100% 19 19.3KB/s 00:00
sftp> bye //退出
[root@tast02 opt]# ls //查看目錄下是否有內(nèi)容
rh ssh_client.txt //成功下載
[root@tast02 opt]# mv ssh_client.txt ssh_server.txt //更改文件名稱
[root@tast02 opt]# ls //查看
rh ssh_server.txt //已更改
[root@tast02 opt]# sftp root@192.168.144.133 //使用sftp命令登錄tast01root用戶
root@192.168.144.133's password: //輸入密碼
Connected to 192.168.144.133.
sftp> cd /home/ //進(jìn)入home目錄
sftp> ls //查看內(nèi)容
ssh_client.txt sun tast
sftp> put ssh_server.txt //將文件上傳至tast01服務(wù)器home目錄中
Uploading ssh_server.txt to /home/ssh_server.txt
ssh_server.txt 100% 19 15.6KB/s 00:00
sftp> bye //退出
[root@tast02 opt]#
[root@tast01 ~]# ls /home/ //查看home目錄內(nèi)容
ssh_client.txt ssh_server.txt sun tast //成功上傳文件
關(guān)于linux的遠(yuǎn)程訪問及控制就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果喜歡這篇文章,不如把它分享出去讓更多的人看到。
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。