> ## Documentation Index
> Fetch the complete documentation index at: https://docs.autodl.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SSH远程连接

> [!TIP]
>
> 如果您是Windows用户，可以使用系统自带的Powershell/CMD登录，如果要更好的终端体验推荐下载使用[Cmder](http://autodl-public.ks3-cn-beijing.ksyun.com/tool/cmder_mini.zip)工具，免安装解压即用。或者使用[XShell工具](https://docs.autodl.com/best_practices/remote/xshell.md)更佳。
>
> 如果是Mac用户，可以使用系统自带的Terminal完成SSH登录。

## SSH登录

开机实例后，找到SSH登录指令

![image\_20250310152031](https://mintcdn.com/yogacom/lAIMbwrdObuK84dw/images/instance/connection/ssh/image_20250310152031.png?fit=max\&auto=format\&n=lAIMbwrdObuK84dw\&q=85\&s=fce9e5503c11d6b54a5fac7fd35d004b)

复制您的SSH登录指令，这里演示使用的是：`ssh -p 10309 root@connect.nmb1.seetacloud.com`

> [!NOTE]
>
> 在`ssh -p 10309 root@connect.nmb1.seetacloud.com`命令中， 各个参数的含义为：
>
> 用户名：root
>
> 主机host： connect.nmb1.seetacloud.com
>
> 端口号：10309

在您的本地终端中输入该命令，输入密码进行登录。（**注意：密码不会显示任何字符，正确输入或鼠标右击粘贴后回车即可**）

![image\_20250310153628](https://mintcdn.com/yogacom/lAIMbwrdObuK84dw/images/instance/connection/ssh/image_20250310153628.png?fit=max\&auto=format\&n=lAIMbwrdObuK84dw\&q=85\&s=bcc554d5e80962c0054792cd5e29e34e)

> [!WARNING]
>
> 如果通过SSH登录后执行训练程序，请使用screen/tmux开守护进程，确保程序不受SSH连接中断影响程序执行！ screen使用方法详见[守护进程](https://docs.autodl.com/instance/execution/daemon.md)。

## SSH免密登录

从「控制台」->「容器实例」->「设置密钥登录」入口进去配置SSH公钥。这样重启后或新创建的实例都能免密码登录，减少复制SSH登录密码的麻烦。密钥/公钥生成方法请看文末

![image\_20250310153712](https://mintcdn.com/yogacom/lAIMbwrdObuK84dw/images/instance/connection/ssh/image_20250310153712.png?fit=max\&auto=format\&n=lAIMbwrdObuK84dw\&q=85\&s=932e35b2494aefbac096700f58f91dad)

![image\_20250310153805](https://mintcdn.com/yogacom/lAIMbwrdObuK84dw/images/instance/connection/ssh/image_20250310153805.png?fit=max\&auto=format\&n=lAIMbwrdObuK84dw\&q=85\&s=4e51f0eb6060e5f847122f767b9bacd0)

**生成RSA密钥对**

Linux/Mac用户：

```bash theme={null}
# 打开Terminal终端，执行命令然后回车即可：
ssh-keygen -t rsa
```

Windows用户：

```bash theme={null}
# 打开Powershell终端，执行命令然后回车即可：
ssh-keygen -t rsa
# 老版本Win报错没有ssh-keygen命令，那么需要安装Git bash后使用Git bash终端执行上面的命令生成
```

生成过程：

生成的路径Win在`C:\Users\{用户名}\.ssh\`，Linux/Mac在：`/home/{用户名}/.ssh/`

![](https://mintcdn.com/yogacom/lAIMbwrdObuK84dw/images/instance/connection/ssh/2025-03-12-14-57-43-image.png?fit=max\&auto=format\&n=lAIMbwrdObuK84dw\&q=85\&s=82d9460ac706cbe0f09ec3729480581e)

生成后有两个文件`id_rsa`和`id_rsa.pub`，前者为私钥（不要泄露），后者为公钥。配置免密即为将公钥内容**完整全部**复制粘贴到AutoDL公钥表单中


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.