ssh常用命令总结

Posted wx580ec8c84ec69

tags:

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

简单用法

> ssh rumenz.com
rumenz@rumenz.com\'s password:

指定用户名登录

方法一

> ssh -l rumenz rumenz.com

方法二

> ssh rumenz@rumenz.com

指定端口登录登录

> ssh rumenz@rumenz.com -p 1234

修改SSH的默认端口

> vim /etc/ssh/ssh_config
Port 1234

//重启ssh 
> systemctl restart sshd.service

对所有数据请求压缩

> ssh -C rumenz@rumenz.com

打开调试模式

> ssh -v rumenz@rumenz.com

OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to rumenz.com port 22.
debug1: Connection established.
debug1: identity file /Users/mac/.ssh/id_rsa type 0
debug1: identity file /Users/mac/.ssh/id_rsa-cert type -1
debug1: identity file /Users/mac/.ssh/id_dsa type -1
debug1: identity file /Users/mac/.ssh/id_dsa-cert type -1
debug1: identity file /Users/mac/.ssh/id_ecdsa type -1
debug1: identity file /Users/mac/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/mac/.ssh/id_ed25519 type -1
debug1: identity file /Users/mac/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/mac/.ssh/id_xmss type -1
debug1: identity file /Users/mac/.ssh/id_xmss-cert type -1
...

绑定源地址

> ssh -b 1.2.3.4 rumenz@rumenz.com

远程执行命令

> ssh rumenz@rumenz.com ls -l

挂载远程文件系统

> sshfs -o idmap=user user@hostname:/home/user ~/Remote
> sshfs -o idmap=user rumenz@rumenz.com:/home/pi ~/rumenz

原文链接:https://rumenz.com/rumenbiji/ssh-common-commands.html
微信公众号:入门小站

以上是关于ssh常用命令总结的主要内容,如果未能解决你的问题,请参考以下文章

Git常用命令总结

Git常用命令总结

Linux常用操作命令总结

总结sshd服务常用参数

git常用命令总结

Linux——详解系统监控和常用命令(top free dstat)