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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2308|回复: 0

root 脚本

[复制链接]
发表于 2016-9-12 15:16:09 | 显示全部楼层 |阅读模式
#!/bin/bash
* G4 G& a1 L* T/ R
#set root password
sudo passwd root
" ^9 O# c- K0 C% 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

4 m( Q/ t4 A" }7 k3 X  ^6 l, ~
#modify profile
sudo sed -i 's/^mesg.*/tty -s \&\& mesg n \|\| true/' /root/.profile
- j! f% q4 _3 v. p
#install openssh
sudo apt install openssh-server
7 _2 R1 g, d; v" s( }  ~5 S
#delay
sleep 1
1 o# B2 c* f# C5 N3 N
#modify conf
sudo sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config

' |) R  p2 A' }7 A* @5 g: N4 d
#restart server
sudo systemctl restart ssh
( |8 U  ^8 r4 A
*******************************************************************************************
* G/ v9 {) S0 T' w0 f' c2 B2 H

6 S; h+ o1 x* D5 k$ t1 c
修改固定IP
; w' n/ b3 D9 u/ A1 q. m$ O

6 j0 V- ~# n9 \8 Y1 h
cd /etc/netplan/
sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.bak

5 y8 V1 j( D) h& \
sudo apt update -y
sudo apt install net-tools -y
8 [4 K; x9 O% g9 o: b* h  `6 s# l
nano 01-network-manager-all.yaml
: K  g" g- y' ^( U! N+ ^) |
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

/ j) F5 g, d  N: y
sudo netplan apply
9 p/ J& x& {2 c' I" \+ z" y
**************************************************
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-17 12:52 , Processed in 0.079022 second(s), 20 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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