[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
相关推荐
2401_83463699几秒前
Linux集群技术-高可用与负载均衡实战解析
linux·运维·负载均衡
吠品2 分钟前
处理 Python 类继承中那些变来变去的初始化参数
linux·前端·python
zahuilg1010 分钟前
Mac原生终端SSH一键快捷连接|无需装软件、极简安装、快速上手
macos·ssh·github·终端
帅大大的架构之路11 分钟前
linux上面的一些小知识点
linux·运维·服务器
光电笑映15 分钟前
进程间通信:深入 System V IPC:共享内存、消息队列与信号量
linux·运维·服务器·c++
RisunJan16 分钟前
Linux命令-patch (为开放源代码软件安装补丁程序)
linux·服务器·算法
皆圥忈29 分钟前
_Linux文件系统与磁盘结构深度解析
linux
向日葵.32 分钟前
linux & qnx & git 命令 2
linux·运维·git
丑过三八线32 分钟前
Systemd Cgroup 驱动详解
linux·ubuntu·容器
‎ദ്ദിᵔ.˛.ᵔ₎33 分钟前
linux的vim编辑器
linux