ssh——config
时间: 2023-10-07 20:05:52 浏览: 52
ssh_config是SSH客户端的配置文件,它位于/etc/ssh/ssh_config。在该文件中,可以设置SSH客户端的各种选项,包括连接到远程主机的端口号。通过设置"Port"选项,可以指定客户端连接远程主机时使用的默认端口号。
与之相对的是sshd_config,它是SSH服务器端的配置文件,位于/etc/ssh/sshd_config。在该文件中,可以设置SSH服务器的各种选项,包括监听的端口号。通过设置"Port"选项,可以指定SSH服务器监听的端口号,即其他人连接到你的主机时使用的端口号。
综上所述,ssh_config是SSH客户端的配置文件,用于设置客户端连接远程主机的默认端口号;而sshd_config是SSH服务器端的配置文件,用于设置服务器监听的端口号。
相关问题
.ssh/config
在SSH中,配置文件有两个:一个是用户配置文件,位于`~/.ssh/config`,另一个是系统配置文件,位于`/etc/ssh/ssh_config`。这两个配置文件可以用来简化SSH相关操作。在用户配置文件中,你可以通过配置`Host`、`HostName`、`User`、`IdentityFile`、`Port`等关键词来定义不同的连接主机和用户。例如,通过在配置文件中添加如下配置:
```
Host example
HostName example.com
User root
IdentityFile ~/.ssh/id_ecdsa
Port 22
```
你就可以使用`ssh example`命令直接登录到`example.com`主机,而不需要输入更多的命令。同样地,你也可以使用`scp`命令方便地向服务器传输文件,例如使用`scp a.txt example:/home/user_name`命令将本地文件`a.txt`传输到`example`主机的`/home/user_name`目录下。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [SSH Config 使用](https://blog.csdn.net/senlin1202/article/details/122081089)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
jenkins ssh server config
To configure Jenkins SSH server, follow these steps:
1. Install the SSH plugin in Jenkins. Go to Manage Jenkins > Manage Plugins > Available and search for "SSH" plugin. Install it and restart Jenkins.
2. Go to Manage Jenkins > Configure System and scroll down to the SSH Server section.
3. Click on "Add" to add a new SSH server configuration.
4. Enter a name for the SSH server configuration and select the "Fixed" option for the port. Enter the port number you want to use for SSH connections.
5. Under the "Credentials" section, click on "Add" to add SSH credentials. Enter the username and private key of the user that will be used to connect to the SSH server.
6. Under the "Host Keys" section, click on "Generate Key" to generate a new SSH host key. This key will be used to authenticate the Jenkins SSH server to clients connecting to it.
7. Click on "Save" to save the SSH server configuration.
Now, you can use an SSH client to connect to the Jenkins SSH server using the credentials you configured. Once connected, you can execute commands or scripts on the Jenkins server remotely.