ssh和scp时指定端口

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ssh和scp时指定端口相关的知识,希望对你有一定的参考价值。

(1)ssh

ssh -p xx $user@ip  

其中xx是端口号,user是用户名,ip是主机ip

比如:ssh -p 23241 root@192.168.1.2

参考:https://blog.csdn.net/z69183787/article/details/76153247 

(2)scp

scp -P xx  upload_file user@ip:$path

其中:-P (大写)后面是端口号,upload_file为需要传送的文件,user是用户名,ip是远端服务器的ip,path是远端路径

比如:scp -P 23231 test1.txt root@192.168.1.2:/usr/test/

参考:https://www.cnblogs.com/jixingke/p/6213074.html

以上是关于ssh和scp时指定端口的主要内容,如果未能解决你的问题,请参考以下文章

01 :ssh管理和批量推key

scp 指定端口

SCP对拷如何连接指定端口远程主机

scp 指定端口(转)

36.scp上传文件到指定端口

SSH服务的搭建