Update ipv4_static_interfaces.cfg

This commit is contained in:
Molly Lau 2023-10-22 19:16:36 +09:00 committed by GitHub
parent 4aeab996be
commit dd570c0f21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -64,19 +64,21 @@ network:
# Enable sshd service. # Enable sshd service.
# Reload systemd. # Reload systemd.
# Make sshd service loading automatically at the next reboot. # Make sshd service loading automatically at the next reboot.
# Restart the sshd service. # Kill the original sshd service so that to liberate the occupation of "0.0.0.0:22" and "[::]:22" to avoid "error: Bind to port sth on sth failed: Address already in use." causes restarting and applying new configs failure of the sshd service.
# Restart sshd service.
# Disable kernel need to restart: https://askubuntu.com/questions/1349884/how-to-disable-pending-kernel-upgrade-message # Disable kernel need to restart: https://askubuntu.com/questions/1349884/how-to-disable-pending-kernel-upgrade-message
# Install some common components. # Install some common components.
# Configure vim for more convenient to use. # Configure vim for more convenient to use.
# Rename netplan config file. # Rename netplan config file.
# Configure fail2ban. # Configure and restart fail2ban.
# Update grub. # Update grub.
# Delete cloud-init config file itself and disable it permanently after first execution. # Delete cloud-init config file itself and disable it permanently after first execution.
runcmd: runcmd:
- systemctl disable --now ssh.socket - systemctl disable ssh.socket
- systemctl enable --now ssh.service - systemctl enable ssh.service
- systemctl daemon-reload - systemctl daemon-reload
- update-rc.d ssh enable - update-rc.d ssh enable
- kill -9 $(ps -ef | grep '/usr/sbin/sshd' | gawk '$0 !~/grep/ {print $2}' | tr -s '\n' ' ')
- /etc/init.d/ssh restart - /etc/init.d/ssh restart
- sed -i 's/#$nrconf{restart} = '"'"'i'"'"';/$nrconf{restart} = '"'"'a'"'"';/g' /etc/needrestart/needrestart.conf - sed -i 's/#$nrconf{restart} = '"'"'i'"'"';/$nrconf{restart} = '"'"'a'"'"';/g' /etc/needrestart/needrestart.conf
- sed -i "s/#\$nrconf{kernelhints} = -1;/\$nrconf{kernelhints} = -1;/g" /etc/needrestart/needrestart.conf - sed -i "s/#\$nrconf{kernelhints} = -1;/\$nrconf{kernelhints} = -1;/g" /etc/needrestart/needrestart.conf