#!/bin/bash
% a+ h3 A% X* T+ N+ |! t #set root password sudo passwd root
6 Y! o- d7 Q7 M/ ?#notes Document content sudo sed -i "s/.*root quiet_success$/#&/" /etc/pam.d/gdm-autologin sudo sed -i "s/.*root quiet_success$/#&/" /etc/pam.d/gdm-password
: _2 R8 ~) a+ W$ B#modify profile sudo sed -i 's/^mesg.*/tty -s \&\& mesg n \|\| true/' /root/.profile
$ Q( z9 t# t9 A& t* F |7 F- j#install openssh sudo apt install openssh-server ; q' }& K" A$ m7 \
#delay sleep 1
% ]" C* T: b% c3 ?#modify conf sudo sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
- f4 c, p8 S0 f9 | b$ f# j3 P#restart server sudo systemctl restart ssh ( b" R6 }5 w2 d3 T% x9 Y4 v1 v
*******************************************************************************************
: F7 L, o0 @9 G/ ?2 R5 J& G7 c) W
修改固定IP $ f5 v: d& |- M5 `9 {9 Y
% q7 e8 l; I; ]" M
cd /etc/netplan/ sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.bak & T D& T9 I1 B; D- U8 a: u
sudo apt update -y sudo apt install net-tools -y
$ G# T: A; r$ T8 r: onano 01-network-manager-all.yaml
, h3 o/ K, m; T* P* m5 _network: renderer: NetworkManager ethernets: ens33: addresses: - 192.168.83.222/24 routes: - to: default via: 192.168.83.2 nameservers: addresses: - 192.168.83.2 - 114.114.114.114 version: 2 1 Q5 b6 M3 w, w; G) Y( W
sudo netplan apply ' M$ i( h% a B7 g5 f
************************************************** |