[linux 配置]Ubuntu SSH登录配置

安装一个Ubuntu操作系统,有可能不能通过SSH登录,可能因为没有安装SSH或者没有配置SSH

安装

···

//打开终端

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

查看安装状态

···

bash 复制代码
ps -e |grep ssh

配置

主要修改两个配置文件:

进入ssh目录下

bash 复制代码
cd /etc/ssh   
bash 复制代码
vi ssh_config
bash 复制代码
Host *
# ForwardAgent no
# ForwardX11 no
# ForwardX11Trusted yes
PasswordAuthentication yes
# HostbasedAuthentication no
# GSSAPIAuthentication no
# GSSAPIDelegateCredentials no
# GSSAPIKeyExchange no
# GSSAPITrustDNS no





# ConnectTimeout 0
# StrictHostKeyChecking ask
# IdentityFile ~/.ssh/identity
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# IdentityFile ~/.ssh/id_ecdsa
# IdentityFile ~/.ssh/id_ed25519
Port 22
# Protocol 2
# Cipher 3des
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
# MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
# EscapeChar ~
# Tunnel no
# TunnelDevice any:any
# PermitLocalCommand no
# VisualHostKey no
# ProxyCommand ssh -q -W %h:%p gateway.example.com
# RekeyLimit 1G 1h
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentication yes
bash 复制代码
vi sshd_config
bash 复制代码
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 1024

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
#PermitRootLogin prohibit-password
PermitRootLogin yes
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile %h/.ssh/authorized_keys

重启SSH

复制代码
sudo /etc/init.d/ssh resart
相关推荐
空堂与归13 小时前
Linux 命令实战:AI 开发者必备的终端操作手册
linux
牢姐与蒯15 小时前
Linux基本指令及知识点(二)
linux·运维·服务器
小玮看世界15 小时前
[Python]从“脏”数据到优雅实现:一个IoT滑动窗口最大值问题的测试驱动优化实录
linux·前端·python
BLi4ee16 小时前
WSL 文件资源管理器左侧 Linux / Ubuntu 入口恢复
linux·ubuntu
自律最差的编程狗16 小时前
从零搭建:VMware + Ubuntu + Docker + MySQL 完整指南
mysql·ubuntu·docker
BLUcoding17 小时前
Ubuntu 开机自启 Kiosk 模式浏览器全屏展示网页配置指南
linux·运维·ubuntu
Kina_C19 小时前
Keepalived 配置管理进阶:使用子配置文件实现模块化与高可读性
linux·网络·keepalived
wsad053219 小时前
CentOS Stream 10 配置静态 IP 完整指南
linux·tcp/ip·centos
Ai拆代码的曹操19 小时前
K8s 实战:CrashLoopBackOff 状态下 kubectl logs 拿不到日志的三层排查方案
linux·docker·kubernetes
tedcloud12319 小时前
Kimi-K3 部署指南:大模型应用开发环境搭建实践
linux·运维·服务器·开源·音视频