当前位置: 首页 > news >正文

ubuntu安装ssh

安装 OpenSSH 服务器(如果尚未安装):

apt-get update && apt-get upgrade -y
sudo apt-get install -y openssh-server

检查 SSH 服务是否正在运行:

sudo service ssh status

如果 SSH 服务未运行,请通过以下命令启动 SSH 服务:

sudo service ssh start

2.1、 修改ssh端口

默认的ssh端口22要修改掉,比如要改成23,在/etc/ssh/sshd_config文件中进行修改:

sudo vim /etc/ssh/ssh_c_config

root@6b0efcb6ebe8:~# cat /etc/ssh/sshd_config# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.# This sshd was compiled with PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.Include /etc/ssh/sshd_config.d/*.conf#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/issh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key# Ciphers and keying
#RekeyLimit default none# Logging
#SyslogFacility AUTH
#LogLevel INFO# Authentication:#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10PubkeyAuthentication yes# Expect .ssh/authorized_keys2 to be disregarded by default in future.
#AuthorizedKeysFile	.ssh/authorized_keys .ssh/authorized_keys2#AuthorizedPrincipalsFile none#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
KbdInteractiveAuthentication no# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the KbdInteractiveAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via KbdInteractiveAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and KbdInteractiveAuthentication to 'no'.
UsePAM yes#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no
#PrintLastLog yes
#TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none# no default banner path
#Banner none# Allow client to pass locale environment variables
AcceptEnv LANG LC_*# override default of no subsystems
Subsystem	sftp	/usr/lib/openssh/sftp-server# Example of overriding settings on a per-user basis
#Match User anoncvs
#	X11Forwarding no
#	AllowTcpForwarding no
#	PermitTTY no
#	ForceCommand cvs serverRSAAuthentication yes
http://www.lryc.cn/news/186611.html

相关文章:

  • webpack不同环境下使用CSS分离插件mini-css-extract-plugin
  • [MongoDB]-权限验证管理
  • bootstrapjs开发环境搭建
  • 远程实时监控管理:5G物联网技术助力配电站管理
  • ubuntu 23.04安装中文输入法
  • java:解析json的几种方式
  • pytorch_神经网络构建1
  • Android 多线程并发详解
  • 系统架构设计:8 论软件架构风格
  • [Elasticsearch] 邻近匹配 (一) - 短语匹配以及slop参数
  • Bootstrap中让元素尽可能往父容器的左侧靠近或右侧造近(左浮动和右浮动)
  • 网络流量安全分析-工作组异常
  • Flink之Watermark源码解析
  • 基于支持向量机SVM和MLP多层感知神经网络的数据预测matlab仿真
  • 【微服务】RedisSearch 使用详解
  • 第三章 栈、队列和数组
  • 使用GitLab CI/CD 定时运行Playwright自动化测试用例
  • Suricata + Wireshark离线流量日志分析
  • JMeter基础 —— 使用Badboy录制JMeter脚本!
  • 3D孪生场景搭建:3D漫游
  • 三、综合——计算机应用基础
  • 【Redis】SpringBoot整合redis
  • 竞赛选题 深度学习 python opencv 火焰检测识别 火灾检测
  • Python Parser 因子计算性能简单测试
  • 【java学习】特殊流程控制语句(8)
  • pyinstaller 使用
  • ELK集群 日志中心集群
  • 有哪些适合初级程序员看的书籍?
  • uniapp iosApp H5+本地文件操作(写入修改删除等)
  • 蓝桥杯 字符串和日期