[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
相关推荐
ha20428941942 小时前
Linux操作系统学习之---线程池
linux·c++·学习
gfdgd xi3 小时前
GXDE 内核管理器 1.0.1——修复bug、支持loong64
android·linux·运维·python·ubuntu·bug
deng-c-f4 小时前
Linux C/C++ 学习日记(43):dpdk(六):dpdk实现发包工具:UDP的发包,TCP的泛洪攻击
linux·dpdk·泛洪
Fuchsia6 小时前
Linux软件编程笔记五——进程Ⅰ
linux·c语言·笔记·操作系统·进程
林一百二十八6 小时前
在Ubuntu上学习C语言(一)
c语言·学习·ubuntu
AC是你的谎言6 小时前
HTTP和HTTPS
linux·网络·c++·网络协议·学习·http·https
c语言鹌鹑蛋7 小时前
【进程间通信】--- 匿名管道,命名管道
linux
江輕木7 小时前
如何使用宿主机软件共享网络给CentOS 7
linux·运维·服务器
代码一天不写我浑森蓝廋7 小时前
CentOS7 使用 centos-release-scl-rh yum库安装 devtoolset
linux·centos·gcc·devtoolset
郁大锤8 小时前
conda虚拟环境占用空间太多,如何清理?
linux·conda