[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
相关推荐
我星期八休息12 分钟前
IT疑难杂症诊疗室:AI时代工程师Superpowers进化论
linux·开发语言·数据结构·人工智能·python·散列表
切糕师学AI30 分钟前
深入解析 Zsh 与 Oh-My-Zsh:打造高效现代化终端
linux·终端·zsh
切糕师学AI2 小时前
Ubuntu 下 Git 完全使用指南
linux·git·ubuntu
老黄编程2 小时前
大型工地实时数据处理与三维重构系统方案
人工智能·ubuntu·信息可视化·重构·入侵检测·大型数据集中处理
浪客灿心2 小时前
Linux网络传输层协议
linux·运维·网络
舟遥遥娓飘飘2 小时前
Nexus4CC 手机电脑同步claude code对话部署教程(基于linux系统)
linux·智能手机·电脑
05候补工程师2 小时前
【ROS 2 具身智能】Gazebo 仿真避坑指南:从“幽灵机器人”到传感器数据流打通
人工智能·经验分享·笔记·ubuntu·机器人
何妨呀~3 小时前
Firewalld防火墙端口配置
linux
切糕师学AI3 小时前
Vim 深度解析:从经典 vi 到现代编辑器之巅
linux·vim·文本编辑器
计算机安禾3 小时前
【Linux从入门到精通】第49篇:服务器故障排查终极指南——思路决定出路
linux·运维·服务器