[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
相关推荐
小糖学代码8 小时前
LLM系列:1.python入门:3.布尔型对象
linux·开发语言·python
shizhan_cloud8 小时前
Shell 函数的知识与实践
linux·运维
Deng8723473488 小时前
代码语法检查工具
linux·服务器·windows
奔跑吧 android9 小时前
【vscode】【远程 ssh 开发】【环境搭建】
ide·vscode·ssh
霍夫曼10 小时前
UTC时间与本地时间转换问题
java·linux·服务器·前端·javascript
月熊11 小时前
在root无法通过登录界面进去时,通过原本的普通用户qiujian如何把它修改为自己指定的用户名
linux·运维·服务器
漫漫求11 小时前
ubuntu22.04 安装报错:grub-install/dev/sda 解决方案
ubuntu
大江东去浪淘尽千古风流人物12 小时前
【DSP】向量化操作的误差来源分析及其经典解决方案
linux·运维·人工智能·算法·vr·dsp开发·mr
赖small强13 小时前
【Linux驱动开发】NOR Flash 技术原理与 Linux 系统应用全解析
linux·驱动开发·nor flash·芯片内执行
IT运维爱好者14 小时前
【Linux】LVM理论介绍、实战操作
linux·磁盘扩容·lvm