[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
相关推荐
李少兄17 分钟前
CentOS系统下前后端项目部署攻略
linux·运维·centos
Two_brushes.3 小时前
【Linux】线程机制深度实践:创建、等待、互斥与同步
linux·运维·服务器·多线程
设计师小聂!5 小时前
Linux系统中部署Redis详解
linux·运维·数据库·redis
kfepiza5 小时前
Debian-10编译安装Mysql-5.7.44 笔记250706
linux·数据库·笔记·mysql·debian·bash
努力做小白6 小时前
Linux驱动11 --- buildroot&杂项驱动开发方法
linux·运维·驱动开发·单片机·嵌入式硬件
帽儿山的枪手7 小时前
追踪网络流量就这么简单 | 进阶篇 | conntrack
linux·windows·网络协议
哈哈浩丶7 小时前
Linux驱动开发1:设备驱动模块加载与卸载
linux·运维·驱动开发
Bulestar_xx7 小时前
20250711_Sudo 靶机复盘
linux·安全·web安全
一位搞嵌入式的 genius7 小时前
暑期自学嵌入式——Day01(C语言阶段)
linux·嵌入式c语言
胡耀超9 小时前
Umi-OCR 的 Docker安装(win制作镜像,Linux(Ubuntu Server 22.04)离线部署)
linux·深度学习·ubuntu·docker·容器·nlp·ocr