找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2702|回复: 0

root 脚本

[复制链接]
发表于 2016-9-12 15:16:09 | 显示全部楼层 |阅读模式
#!/bin/bash
, Y+ ]! l4 j& F/ ~
#set root password
sudo passwd root

/ p" q* y! b" g/ ?) r! T
#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 v& ]# ]& b* x( F
#modify profile
sudo sed -i 's/^mesg.*/tty -s \&\& mesg n \|\| true/' /root/.profile
& k, I8 ]( J/ G9 D0 D+ y& S$ }, N9 ~% `
#install openssh
sudo apt install openssh-server
2 o9 S, W. h! U2 m
#delay
sleep 1

7 R: M$ y% W2 v0 r! \9 T
#modify conf
sudo sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
8 ?4 n, E4 t$ A1 ?! D2 H/ G" ?
#restart server
sudo systemctl restart ssh

: U3 @: @! w. L
*******************************************************************************************

- B$ i) G: U' ?; T  \2 R
+ V2 p' g( q& Q# d% y6 {# Y
修改固定IP
/ L& }4 S4 }; `' G# S, T- }! X
0 ~: I! p0 T8 @) u- a5 p1 W
cd /etc/netplan/
sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.bak

- g8 t( k  M9 t1 J: w8 ~1 {
sudo apt update -y
sudo apt install net-tools -y
. D$ n  }, K$ u7 s! \% ^
nano 01-network-manager-all.yaml
3 A" }: T2 R" C1 M( I" {0 H
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
2 A, ^- z) O$ f& Q% W
sudo netplan apply

4 v7 |: A$ b: C6 V
**************************************************
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-3-7 08:46 , Processed in 0.090842 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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