华强北电脑城 龙岗电子世界 龙华电脑城  凯尔电脑

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2313|回复: 0

root 脚本

[复制链接]
发表于 2016-9-12 15:16:09 | 显示全部楼层 |阅读模式
#!/bin/bash
! Z% T! g; a' k; i3 z, r! o! y
#set root password
sudo passwd root
  T$ l1 @" n$ B7 z# o. N& 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

5 S- p# \$ n) n6 I) N! [% D( Q
#modify profile
sudo sed -i 's/^mesg.*/tty -s \&\& mesg n \|\| true/' /root/.profile

# O' L! U( ]; h: s- X3 g" H
#install openssh
sudo apt install openssh-server
& W/ d3 ?: f4 _5 s& M& G
#delay
sleep 1

  s! C; ?: ~- z9 H+ g% D$ o# Q
#modify conf
sudo sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
, d9 k) k/ y1 {* A. H- V- I1 D
#restart server
sudo systemctl restart ssh
& q3 i) i4 O5 ?& s: X  S8 y
*******************************************************************************************
' u1 A7 b3 U6 c4 D; ^- O9 ?

8 w% @0 D' F/ o4 d# H2 w! x5 \4 k9 v
修改固定IP
7 \% Z4 C. X. V( Z' m/ F# B

! k# q+ L3 I8 g6 P% ~
cd /etc/netplan/
sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.bak
0 Z9 D5 Q* B. o
sudo apt update -y
sudo apt install net-tools -y
( R: {" \4 @7 y$ _: `3 e
nano 01-network-manager-all.yaml
3 z8 P. [# P, f4 ]8 X, _
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
  M4 A2 D( d$ U' M
sudo netplan apply

* m* j, P- q3 L2 C5 s$ B" q# s
**************************************************
回复

使用道具 举报

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

本版积分规则

QQ|华强北 电脑城 龙岗电子世界 龙华电脑城 pc4g.com ( 粤ICP备16039863号 )

GMT+8, 2025-6-19 14:18 , Processed in 0.098048 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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