天天看點

linux 添加ssh和開啟ssh服務apt管理的ubuntu

是在ubuntu下出現的需求 現筆記記錄

apt-get  update

更新源指令

apt-get  install  openssh-server

安裝ssh服務

容易出現無法定位軟體包。出現此問題是因為軟體源沒有更新 可以嘗試更新指令一試。或編輯etc/apt/source.list或sources.list ,添加源位址

如:

阿裡雲Ubuntu 18.04源

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

還可以百度一下,查找源

然後apt-get  update

更新

ps -e  |  grep  ssh

檢測ssh服務是否啟動

 看到有ssh字樣就是啟動了

如未啟動就要手動啟動服務

/etc/init.d/ssh start
直接find查找ssh找到路徑,或到etc下手動搜尋
配置ssh-server,配置檔案位于/etc/ssh/sshd_config,預設端口為22,為了安全,一般自定義為其他端口,然後重新開機

/etc/init.d/ssh resart      
然後用xshll或putty連接配接