找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2705|回复: 0

root 脚本

[复制链接]
发表于 2016-9-12 15:16:09 | 显示全部楼层 |阅读模式
#!/bin/bash
+ V5 T& ^  W8 Z0 m
#set root password
sudo passwd root

1 S' i4 t- i9 d; R. X: }
#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
& g( m* e* F6 E) I, ^# g4 x& \
#modify profile
sudo sed -i 's/^mesg.*/tty -s \&\& mesg n \|\| true/' /root/.profile
, G2 y0 a% N" k8 z
#install openssh
sudo apt install openssh-server
6 o0 ?" H, E+ g
#delay
sleep 1

+ E8 R2 P$ S! Q" R2 |+ b' ]6 i
#modify conf
sudo sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
9 T, c. a/ f: ^+ B. u+ G
#restart server
sudo systemctl restart ssh
$ Z, @7 j0 D/ B2 y! b! ?! a
*******************************************************************************************
0 {; j; m. O) `* G9 E$ N% x

; d5 c" B6 X* h1 S# N, n' W
修改固定IP
  i/ d! s4 J% a, B* L5 F& }& L

0 A4 p" W5 }: d  n6 m; |
cd /etc/netplan/
sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.bak

4 V& r! w  y) y+ r+ I6 ^
sudo apt update -y
sudo apt install net-tools -y

, I- k$ ?& n0 N
nano 01-network-manager-all.yaml
/ ~% `* ]8 O: m! y
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

+ }, h$ ^* Z$ K9 x& ~
sudo netplan apply

$ R7 R6 D$ p5 E% }
**************************************************
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|赛格电脑 华强北 电脑城 南山赛格 龙岗电子世界 龙华电脑城 沙井电脑城 松岗电脑城 pc4g.com ( 粤ICP备16039863号 )

GMT+8, 2026-3-7 11:36 , Processed in 0.092166 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表