ubuntu ssh server 安装

我写的文档复制过来没有图片,所以我会把写的文档上传,大家可以下载(下面的是我用qq截图截的)

因为我们学校有镜像网站,所以我修改了源,把我的/etc/apt/sources.list 更改了,大家也可以和我一样,因为是开放的,所以大家照写就行了,你们也可以在网上找一些镜像网站,只要能用就行。

第一步:找到/etc/apt/sources.list


打开

然后写入地址:


保存后

在终端打入:apt-get  update  更新源


更新完成后就正式安装ssh service了  如不不想改,可以忽略前面所有步骤

 

在终端输入 apt-cache search ssh 查询你所需要的版本

如下图:


查到后输入:apt-get install openssh-server


进行安装

安装完成后查看ssh服务是否启动

有sshd说明已经启动服务

 

ssh server 安装完成:

 

查看ubuntu的ip


在windows下连接

先下载一个ssh 客户端


打开,输入ip和用户(root),如果连接错误,在文章的末尾,会出解决办法:

再输入用户密码,进去后可以看见

 

 

由于笔者事先配置好了,所以我就直接写修改哪里就行了

打开/etc/ssh/sshd-config



保存退出再次连接就行了  下面给出了所有信息


# Package generated configuration file

# See the sshd_config(5) manpage fordetails

 

# What ports, IPs and protocols we listenfor

Port 22

# Use these options to restrict which interfaces/protocolssshd will bind to

#ListenAddress ::

#ListenAddress 0.0.0.0

Protocol 2

# HostKeys for protocol version 2

HostKey /etc/ssh/ssh_host_rsa_key

HostKey /etc/ssh/ssh_host_dsa_key

HostKey /etc/ssh/ssh_host_ecdsa_key

HostKey /etc/ssh/ssh_host_ed25519_key

#Privilege Separation is turned on forsecurity

UsePrivilegeSeparation yes

 

# Lifetime and size of ephemeral version 1server key

KeyRegenerationInterval 3600

ServerKeyBits 1024

 

# Logging

SyslogFacility AUTH

LogLevel INFO

 

# Authentication:

LoginGraceTime 120

PermitRootLogin yes

StrictModes yes

 

RSAAuthentication yes

PubkeyAuthentication yes

#AuthorizedKeysFile     %h/.ssh/authorized_keys

 

# Don't read the user's ~/.rhosts and~/.shosts files

IgnoreRhosts yes

# For this to work you will also need hostkeys in /etc/ssh_known_hosts

RhostsRSAAuthentication no

# similar for protocol version 2

HostbasedAuthentication no

# Uncomment if you don't trust~/.ssh/known_hosts for RhostsRSAAuthentication

#IgnoreUserKnownHosts yes

 

# To enable empty passwords, change to yes(NOT RECOMMENDED)

PermitEmptyPasswords no

 

# Change to yes to enablechallenge-response passwords (beware issues with

# some PAM modules and threads)

ChallengeResponseAuthentication no

 

# Change to no to disable tunnelled cleartext passwords

# Lifetime and size of ephemeral version 1server key

KeyRegenerationInterval 3600

ServerKeyBits 1024

 

# Logging

SyslogFacility AUTH

LogLevel INFO

 

# Authentication:

LoginGraceTime 120

PermitRootLogin yes

StrictModes yes

 

RSAAuthentication yes

PubkeyAuthentication yes

#AuthorizedKeysFile     %h/.ssh/authorized_keys

 

# Don't read the user's ~/.rhosts and~/.shosts files

IgnoreRhosts yes

# For this to work you will also need hostkeys in /etc/ssh_known_hosts

RhostsRSAAuthentication no

# similar for protocol version 2

HostbasedAuthentication no

发布了24 篇原创文章 · 获赞 22 · 访问量 9万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章