如何禁用SSHD自動啟動?

2021-10-02 11:46:11 字數 2210 閱讀 9022

安裝openssh-server後,每次啟動時伺服器都會啟動。如果我想要它是手動的,我需要做什麼?

在0.6.7+的upstart中,我會在作業檔案中新增乙個」manual」節。

10.04有新貴0.6.5-8。在這種情況下,禁用ssh自動啟動的首選方法是什麼?

將/etc/init/ssh.conf重新命名為/etc/init/ssh.conf.disabled。

sudo mv /etc/init/ssh.conf /etc/init/ssh.conf.disabled
這應該足夠了,:

update-rc.d ssh enable # sets the default runlevels to on 

update-rc.d ssh disable # sets all to off

在你的/etc/init/ssh.conf中,注釋掉行開頭:

# ssh - openbsd secure shell server

## the openssh server provides secure shell access to the system.

description "openssh server"

#start on filesystem or runlevel [2345]

stop on runlevel [!2345]

respawn

respawn limit 10 5

umask 022

給讀者注意:

對我來說(ubuntu 14.xx)只有bryan agee的回答才有效:/etc/init/ssh.conf:注釋掉「從檔案系統或執行級別開始…」行

其他人為什麼不呢?

sudo mv /etc/init/ssh.conf /etc/init/ssh.conf.disabled

將導致完全停用服務。然後它不再可以通過「service ssh start」啟動了。

update-rc.d ssh enable # sets the default runlevels to on

根本不起作用(可能使用不同的自動啟動例程)

/etc/init/ssh.conf.override with 「manual」

根本不起作用

touch /etc/ssh/sshd_not_to_be_run

也完全禁用系統

sudo apt-get install bum

不錯的軟體,但它不顯示ssh,所以這裡無關

提問的人:為什麼上面的答案都在這裡?啟動系統是如此復​​雜或沒有人嘗試他的解決方案? oo

對於具有systemd的系統,正確的方法是

sudo systemctl disable ssh.service
然後

sudo systemctl stop ssh.service
sudo apt-get install bum
使用管理許可權啟動bum,禁用openssh-server,確認,完成。

對於由upstart啟動的ssh版本,請執行touch /etc/ssh/sshd_not_to_be_run。 upstart init指令碼檢查此檔案,如果存在,則不會啟動sshd。

提供的手動方法/etc/init/ssh.config.override方法對我來說不適用於ubuntu 14.04.03。sshd仍然自動啟動。

/etc/ssh/sshd_not_to_be_run方法可防止手動啟動sshd

我不得不使用brian agee的方法在/etc/init/ssh.conf上刪除」start on」。然後手動啟動sshd

sudo service ssh start

sshd啟動失敗

原文寫於2004年11月20日01 56星期六,注 昨晚,167的ssh連不上了 最後在biao哥的指導下,成功修復 昨晚到文體值班,發現167無法ssh,說22埠connection refused 而http與ftp都正常 ssh連不上就什麼也幹不了,167沒有顯示器也沒有鍵盤。向biao哥求救...

systemctl 如何啟動 關閉 啟用 禁用服務

啟動服務 systemctl start service 關閉服務 systemctl stop service 重啟服務 systemctl restart service 顯示服務的狀態 systemctl status service 在開機時啟用服務 systemctl enable ser...

Linux多sshd啟動問題

環境中啟用兩個sshd,乙個監聽22223埠,乙個監聽33332埠,監聽22223埠的配置檔案放在 etc sshd sshd config 為安裝sshd後預設配置 監聽33332埠的配置檔案放在 opt data luban luban c build luban sshd config 自定義...