ubuntu ssh

前置

需要知道自己的ip

如果没有ifconfig

bash 复制代码
sudo apt-get install net-tools

然后

bash 复制代码
ifconfig

中文用户

win+r,输入

cmd 复制代码
intl.cpl

在git里,选zh_cn和UTF-8

安装

bash 复制代码
sudo apt-get install -y openssh-client openssh-server

设置开机启动

bash 复制代码
sudo systemctl enable ssh
bash 复制代码
sudo nano /etc/ssh/sshd_config

添加一行

bash 复制代码
PermitRootLogin yes
bash 复制代码
sudo systemctl restart ssh

本地远程

bash 复制代码
ssh username@remote_ip_address

免密登录

按照上面的步骤会发现每次都需要输入密码,这里通过生成密钥来解决

在本地生成密钥

可以考虑用git bash

bash 复制代码
ssh-keygen -t rsa
# ⽣成 id_rsa 和 id_rsa.pub, 并且⼀般存储在 ~/.ssh/下
ssh-keygen -b 4096 -t rsa
# 这个则是更安全的版本

第一个:key存储位置

第二个:私钥密码,默认无密码,如果设置了私钥密码,在进行免密登录时需要输入私钥密码

第三个:再输入一遍私钥密码

我这里是全默认

bash 复制代码
ssh-copy-id username@remote_ip_address

如果有权限问题,可以考虑执行下面这个

bash 复制代码
sudo chmod 700 .ssh
sudo chmod 600 .ssh/authorized_keys

配置防火墙

这一步可选

bash 复制代码
sudo apt-get install -y firewalld
bash 复制代码
# ssh
sudo firewall-cmd --permanent --add-port=22/tcp
sudo firewall-cmd --permanent --add-service=ssh 
# teamviewer
sudo firewall-cmd --permanent --add-port=5938/tcp
sudo firewall-cmd --permanent --add-port=5938/udp
sudo firewall-cmd --permanent --add-port=443/tcp
sudo firewall-cmd --permanent --add-port=80/tcp
# tensorboard
sudo firewall-cmd --permanent --add-port=6006/tcp
# jupyter
sudo firewall-cmd --permanent --add-port=8888/tcp

sudo systemctl reload firewalld
bash 复制代码
sudo firewall-cmd --list-all

vscode

安装插件

点击左侧远程,然后ssh的设置

接着选user下的

接着配置

bash 复制代码
Host 任意名字
    HostName 远程ip
    User 远程用户名

我这里配了2个

刷新一下

连接

选择项目

这个选则相信

之后这里修改,远程也会改

tensorboard

bash 复制代码
tensorboard --logdir="xxx" --host remote_ip

然后在本地输入最后显示的网址就能访问了

相关推荐
orion571 天前
Missing Semester Class1:course overview and introduction of shell
linux
用户120487221611 天前
Linux驱动编译与加载
linux·嵌入式
用户805533698032 天前
Input 子系统架构:Core、Handler、Driver 三层是怎么协作的
linux·嵌入式
用户805533698032 天前
RK-Forge外设系列开篇 - 把板子从「能启动」变成「能用」:Ethernet/SPI/MMC 三个纯接线外设
linux·github·嵌入式
七歌杜金房2 天前
我终于又有了自己的 Linux 电脑
linux·debian·mac
tntxia3 天前
linux curl命令详解_curl详解
linux
扛枪的书生3 天前
Linux 网络管理器用法速查
linux
顺风尿一寸3 天前
Java Socket 内核之旅:从 SocketChannel.read() 到 tcp_recvmsg 与 epoll 的完整调用链路
linux
XIAOHEZIcode4 天前
Ubuntu 终端美化全栈指南:Bash 到 Kitty 踩坑实录
linux·ubuntu·命令行
唐青枫4 天前
别再只会用 cron:Linux systemd Timer 定时任务实战详解
linux