![如何從命令列修改設定檔?](https://rvso.com/image/1036644/%E5%A6%82%E4%BD%95%E5%BE%9E%E5%91%BD%E4%BB%A4%E5%88%97%E4%BF%AE%E6%94%B9%E8%A8%AD%E5%AE%9A%E6%AA%94%EF%BC%9F.png)
例如,我經常需要登入新的虛擬機器只是為了打開“/etc/ssh/sshd_config”並將“PasswordAuthentication”選項設為“no”。
這樣,我就無法自動化這個流程。
如何透過從命令列進行修改來解決類似的任務?
答案1
sudo sed -i 's/PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/ssh_config
例如,我經常需要登入新的虛擬機器只是為了打開“/etc/ssh/sshd_config”並將“PasswordAuthentication”選項設為“no”。
這樣,我就無法自動化這個流程。
如何透過從命令列進行修改來解決類似的任務?
sudo sed -i 's/PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/ssh_config