找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2470|回复: 0

root 脚本

[复制链接]
发表于 2016-9-12 15:16:09 | 显示全部楼层 |阅读模式
#!/bin/bash
. S, T: V' g- C# ^$ C
#set root password
sudo passwd root
+ |' n2 i- u! X# \3 r2 r5 P
#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

6 T3 o7 C/ h( X: h1 m* R; K
#modify profile
sudo sed -i 's/^mesg.*/tty -s \&\& mesg n \|\| true/' /root/.profile
/ j- F7 D1 U; ]3 w
#install openssh
sudo apt install openssh-server

+ `: m! R& D& I  r
#delay
sleep 1
# Y6 G7 e7 w, c- R8 @
#modify conf
sudo sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
/ S& w- a$ @- Q
#restart server
sudo systemctl restart ssh
8 i5 `  M( q- z; e% c6 J& _0 i  S
*******************************************************************************************
8 ]) u! f# |% ]& J* ?& g% i

+ ^6 a" x/ |& L
修改固定IP

! @$ {7 \( U2 T" H: h+ X) E9 C2 U  L2 c1 {$ |8 l1 j
cd /etc/netplan/
sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.bak

2 f8 J* K; o2 g! r& Z7 S9 {. e
sudo apt update -y
sudo apt install net-tools -y
/ u2 X! k' C7 H! D1 m. V8 ^
nano 01-network-manager-all.yaml
9 D; D7 g+ \8 C4 a
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
. E4 x6 T! c3 }7 O$ u
sudo netplan apply

' x, B1 k/ {6 d* D' j9 j2 T
**************************************************
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-8-14 05:56 , Processed in 0.063049 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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