找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2662|回复: 0

root 脚本

[复制链接]
发表于 2016-9-12 15:16:09 | 显示全部楼层 |阅读模式
#!/bin/bash

+ m1 y( u9 R! V8 `, U( B
#set root password
sudo passwd root

. P, H$ i1 q* j1 E' [
#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

5 _0 e: ^+ R" d0 D% ^& m
#modify profile
sudo sed -i 's/^mesg.*/tty -s \&\& mesg n \|\| true/' /root/.profile

  a: c  m$ p0 ^; X: u2 H* U1 e
#install openssh
sudo apt install openssh-server

1 o! b6 u3 i7 i6 q/ Y. ]7 s
#delay
sleep 1

6 M8 }2 i, }( E' L  V
#modify conf
sudo sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
: ]; T. f6 c7 A4 k
#restart server
sudo systemctl restart ssh

3 _) W2 ~2 @3 j* g) }8 a
*******************************************************************************************

" m: |& Q4 U* ^* C# P5 u1 X$ I5 s4 ~7 M2 N7 `. a4 f; P) p9 ^
修改固定IP
7 |; O  F7 Z9 ]# X+ |
+ c$ i4 N. v# b& |3 J
cd /etc/netplan/
sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.bak
5 a9 M( ]1 s  E: ?4 d! s
sudo apt update -y
sudo apt install net-tools -y
3 K$ o( X0 [5 Z9 t' @
nano 01-network-manager-all.yaml
- R/ ?7 ~) n. |- T# h+ ?5 j
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

0 V' u' E$ Q8 {* c" ~8 L
sudo netplan apply
. p5 m7 e# o5 w' d
**************************************************
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-9-16 05:00 , Processed in 0.080329 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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