当前位置: 首页 > news >正文

screen使用——关机时在服务器上跑代码

一、连接服务器

原理:通过 SSH(Secure Shell)协议建立本地与远程服务器的安全连接通道,使得可以在本地操作服务器。


操作:使用 VSCode 或 cmd 的 ssh 连接到服务器,这里我选择cmd。

检查是否安装 OpenSSH

在 Windows 10 及以上版本中,系统可能已经自带 OpenSSH 客户端。打开命令提示符(cmd),输入 “ssh”,如果出现关于 SSH 的帮助信息,说明已经安装。

C:\Users\吴伊晴>ssh
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface][-b bind_address] [-c cipher_spec] [-D [bind_address:]port][-E log_file] [-e escape_char] [-F configfile] [-I pkcs11][-i identity_file] [-J [user@]host[:port]] [-L address][-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port][-Q query_option] [-R address] [-S ctl_path] [-W host:port][-w local_tun[:remote_tun]] destination [command]

连接到服务器

  1. 打开 cmd。
  2. 输入 “ssh username@server_ip”,其中 “username” 是你在服务器上的用户名,“server_ip” 是服务器的 IP 地址。
  3. 首次连接时,系统可能会提示你确认服务器的指纹,输入 “yes” 确认。
  4. 然后输入你的服务器密码,按下回车键。如果密码正确,你将成功连接到服务器。
C:\Users\吴伊晴>ssh -p 19100 root@i26mn82mwdjl6xzbsky.deepln.com
The authenticity of host '[i26mn82mwdjl6xzbsky.deepln.com]:19100 ([118.180.21.62]:19100)' can't be established.
ED25519 key fingerprint is SHA256:1wVKEfi7h61INBh5GA9wJsS9+EdeBMgWmY/Rja1xG9Q.
This host key is known by the following other names/addresses:C:\Users\吴伊晴/.ssh/known_hosts:35: [zikdwu07oynmyzrqsnow.deepln.com]:40457C:\Users\吴伊晴/.ssh/known_hosts:38: [hqvumkbagsino1vosnow.deepln.com]:54718C:\Users\吴伊晴/.ssh/known_hosts:39: [dv9owtzqvjzr4chdzky.deepln.com]:19100
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[i26mn82mwdjl6xzbsky.deepln.com]:19100' (ED25519) to the list of known hosts.
root@i26mn82mwdjl6xzbsky.deepln.com's password:
Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 5.19.0-50-generic x86_64)* Documentation:  https://help.ubuntu.com* Management:     https://landscape.canonical.com* Support:        https://ubuntu.com/proThis system has been minimized by removing packages and content that are
not required on a system that users do not log into.To restore this content, you can run the 'unminimize' command.
-------------------------------------------------------------------------------------
-                                ###重要###                                        -
-                                                                                  -  -

http://www.mrgr.cn/news/33795.html

相关文章:

  • 蓝桥杯嵌入式的学习总结
  • UE学习篇ContentExample解读-----------Blueprint_Overview
  • 《深度学习》—— 卷积神经网络(CNN)的简单介绍和工作原理
  • 深度学习与应用:人体关键点检测
  • SpringBoot项目License证书生成与验证(TrueLicense) 【记录】
  • 一种求解无人机三维路径规划的高维多目标优化算法,MATLAB代码
  • Java-Part 0
  • 2009考研数学真题解析-数二:
  • 【JavaWeb】一、Web 开发概述
  • 将相机深度图转接为点云的ROS2功能包
  • Java基础 — 正则表达式+函数式编程
  • 将任意图像增强模型与ultralytics中任意模型进行结合,支持自定义图像增强模块的loss,实现端到端训练
  • Tomcat中间件常见漏洞复现
  • #面试系列-腾讯后端一面
  • 思维商业篇(4)—产业上下游定
  • AJAX入门
  • 2024PDF内容修改秘籍:工具推荐与技巧分享
  • 【C++笔记】C++编译器拷贝优化和内存管理
  • 【VLM小白指北 (1) 】An Introduction to Vision-Language Modeling
  • 【Makefile】linux学习总结