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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2310|回复: 0

root 脚本

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

% a+ h3 A% X* T+ N+ |! t
#set root password
sudo passwd root

6 Y! o- d7 Q7 M/ ?
#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

: _2 R8 ~) a+ W$ B
#modify profile
sudo sed -i 's/^mesg.*/tty -s \&\& mesg n \|\| true/' /root/.profile

$ Q( z9 t# t9 A& t* F  |7 F- j
#install openssh
sudo apt install openssh-server
; q' }& K" A$ m7 \
#delay
sleep 1

% ]" C* T: b% c3 ?
#modify conf
sudo sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config

- f4 c, p8 S0 f9 |  b$ f# j3 P
#restart server
sudo systemctl restart ssh
( b" R6 }5 w2 d3 T% x9 Y4 v1 v
*******************************************************************************************

: F7 L, o0 @9 G/ ?2 R5 J& G7 c) W
修改固定IP
$ f5 v: d& |- M5 `9 {9 Y
% q7 e8 l; I; ]" M
cd /etc/netplan/
sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.bak
& T  D& T9 I1 B; D- U8 a: u
sudo apt update -y
sudo apt install net-tools -y

$ G# T: A; r$ T8 r: o
nano 01-network-manager-all.yaml

, h3 o/ K, m; T* P* m5 _
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
1 Q5 b6 M3 w, w; G) Y( W
sudo netplan apply
' M$ i( h% a  B7 g5 f
**************************************************
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-17 16:56 , Processed in 0.085049 second(s), 17 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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