2025-12-02 14:17:49 +08:00

55 lines
4.1 KiB
Vue
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<h1 id="ssh">SSH远程连接<a class="headerlink" href="#ssh" title="Permanent link"></a></h1>
<hr>
<blockquote>
<p>如果您是Windows用户可以使用系统自带的Powershell/CMD登录如果要更好的终端体验推荐下载使用<a
href="http://autodl-public.ks3-cn-beijing.ksyun.com/tool/cmder_mini.zip">Cmder</a>工具免安装解压即用或者使用<a
href="../xshell/">XShell工具</a>更佳</p>
<p>如果是Mac用户可以使用系统自带的Terminal完成SSH登录</p>
</blockquote>
<h2 id="ssh_1">SSH登录<a class="headerlink" href="#ssh_1" title="Permanent link"></a></h2>
<p>开机实例后找到SSH登录指令</p>
<p><img alt="image_20250310152031" src="../ssh.assets/image_20250310152031.png"></p>
<p>复制您的SSH登录指令这里演示使用的是<code>ssh -p 10309 root@connect.nmb1.seetacloud.com</code> </p>
<blockquote>
<p><code>ssh -p 10309 root@connect.nmb1.seetacloud.com</code>命令中 各个参数的含义为</p>
<p>用户名root</p>
<p>主机host connect.nmb1.seetacloud.com</p>
<p>端口号10309</p>
</blockquote>
<p>在您的本地终端中输入该命令输入密码进行登录<strong>注意密码不会显示任何字符正确输入或鼠标右击粘贴后回车即可</strong></p>
<p><img alt="image_20250310153628" src="../ssh.assets/image_20250310153628.png"></p>
<blockquote>
<p>如果通过SSH登录后执行训练程序请使用screen/tmux开守护进程确保程序不受SSH连接中断影响程序执行 screen使用方法详见<a
href="../daemon/">守护进程</a></p>
</blockquote>
<h2 id="ssh_2">SSH免密登录<a class="headerlink" href="#ssh_2" title="Permanent link"></a></h2>
<p>从控制台-容器实例-&gt;设置密钥登录入口进去配置SSH公钥这样重启后或新创建的实例都能免密码登录减少复制SSH登录密码的麻烦密钥/公钥生成方法请看文末</p>
<p><img alt="image_20250310153712" src="../ssh.assets/image_20250310153712.png"></p>
<p><img alt="image_20250310153805" src="../ssh.assets/image_20250310153805.png"></p>
<p><strong>生成RSA密钥对</strong></p>
<p>Linux/Mac用户</p>
<div class="highlight">
<pre><span></span><code><span class="c1"># 打开Terminal终端执行命令然后回车即可</span>
ssh-keygen<span class="w"> </span>-t<span class="w"> </span>rsa
</code></pre>
</div>
<p>Windows用户</p>
<div class="highlight">
<pre><span></span><code><span class="c1"># 打开Powershell终端执行命令然后回车即可</span>
ssh-keygen<span class="w"> </span>-t<span class="w"> </span>rsa
<span class="c1"># 老版本Win报错没有ssh-keygen命令那么需要安装Git bash后使用Git bash终端执行上面的命令生成</span>
</code></pre>
</div>
<p>生成过程</p>
<p>生成的路径Win在<code>C:\Users\{用户名}\.ssh\</code>Linux/Mac在<code>/home/{用户名}/.ssh/</code></p>
<p><img alt="" src="../assets/2025-03-12-14-57-43-image.png"></p>
<p>生成后有两个文件<code>id_rsa</code><code>id_rsa.pub</code>前者为私钥不要泄露后者为公钥配置免密即为将公钥内容<strong>完整全部</strong>复制粘贴到AutoDL公钥表单中
</p>
</article>
</div>
</div>
</template>