[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
相关推荐
txzz888826 分钟前
CentOS-Stream-10 搭建NTP服务器(一)
linux·服务器·centos·ntp服务
冉佳驹1 小时前
Linux ——— 虚拟地址、页表、物理地址与 waitpid 和进程管理中的核心概念和技术
linux·waitpid·进程程序替换·exit·地址空间·非阻塞轮询·exec系列
最后一个bug2 小时前
CPU的MMU中有TLB还需要TTW的快速查找~
linux·服务器·系统架构
小杨同学493 小时前
Linux 从入门到实战:常用指令与 C 语言开发全指南
linux
福尔摩斯张3 小时前
Linux的pthread_self函数详解:多线程编程中的身份标识器(超详细)
linux·运维·服务器·网络·网络协议·tcp/ip·php
ArrebolJiuZhou3 小时前
02arm指令集(一)——LDR,MOV,STR的使用
linux·网络·单片机
一只旭宝3 小时前
Linux专题八:生产者消费者,读写者模型以及网络编程
linux·网络
Web极客码3 小时前
如何在 Linux 中终止一个进程?
linux·运维·服务器
大聪明-PLUS4 小时前
Linux 中的 GPIO 驱动程序
linux·嵌入式·arm·smarc
Clarence Liu4 小时前
虚拟机与容器的差异与取舍
linux·后端·容器