---
title: "ssh中使用别名登录"
author: "cserw3c"
date: "2014-11-21T15:47:10Z"
tags: []
categories: ["操作系统"]
slug: "ssh"
draft: false
lastmod: "2014-11-21T15:47:53Z"
id: 2158923
url: "https://solomon2012.iteye.com/blog/2158923"
---

```
ssh命令会加载 ~/.ssh/config 文件中的机器别名，默认该文件时不存在的，可以新建一个，然后往里添加如下内容：

 Host product

 HostName 192.168.1.101
 User root

 ssh product代替ssh  root@19.168.1.101 

 Host test
 HostName 192.168.1.102
 User root
 Port 22
 ssh test代替ssh  root@192.168.1.101 -p 22



```