[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
相关推荐
Awh-8 分钟前
ARM 裸机开发 day02 学习笔记
linux·arm开发·arm
牢姐与蒯33 分钟前
Linux进程间通信(一).进程间通信概念&&环境切换(着重强调vscode)
linux·运维·服务器·ubuntu
M78佐菲42 分钟前
ARM学习笔记(四)
linux·arm开发·笔记·嵌入式硬件·学习
东鹏特饮43 分钟前
redhat9 配置yum 阿里云
linux·运维·redhat·yum
昌原的儿子LEO1 小时前
i.MX6ULL 裸机开发 C 语言驱动与 BSP 工程管理学习总结
linux·arm开发·学习
lqg_zone1 小时前
CentOS 7 虚拟机磁盘 I/O 卡顿排查实录:从 iostat 异常到虚拟盘后端故障的完整定位
linux·服务器·mysql·centos
kkkkkkkkkk_Z1 小时前
单片机|学习日记:单片机底层架构与寄存器操作全解析
linux·笔记·单片机·学习·51单片机
xiaoye-duck1 小时前
《Linux 网络编程》深入理解 IP 协议(一):网络层基础与 IP 协议头详解
linux·网络·ip
ao-weilai1 小时前
Linux网络编程:Linux Socket TCP
linux·服务器·网络
顶点多余1 小时前
9.16 面试总结
linux·面试·职场和发展