我寫的文檔複製過來沒有圖片,所以我會把寫的文檔上傳,大家可以下載(下面的是我用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