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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2309|回复: 0

root 脚本

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

+ C+ W$ n' @" a/ q8 b0 h
#set root password
sudo passwd root

  a- w: b1 `, M$ P' W& M& 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
( _+ n  Z: |; T" A- ?  V3 r
#modify profile
sudo sed -i 's/^mesg.*/tty -s \&\& mesg n \|\| true/' /root/.profile

7 H2 a2 e1 c9 Q, s( C) A& {% D. h
#install openssh
sudo apt install openssh-server

: q0 L- U) W  d8 A1 @0 Q
#delay
sleep 1

* Q; l, B# y( X6 w% {" b4 G
#modify conf
sudo sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
  N$ h5 _6 [' l( U% n
#restart server
sudo systemctl restart ssh

! H( y0 M) s% Z6 a7 P
*******************************************************************************************
, k$ f" h( X% z0 c2 p  y4 H" K+ {$ W

1 r6 |6 b4 w5 F) j2 j& f
修改固定IP
$ S1 I9 H- i3 Z$ e7 G" D
- v& s' H% A1 n8 J' g  S. H
cd /etc/netplan/
sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.bak

. z  M* v3 H1 a; C) ~" y
sudo apt update -y
sudo apt install net-tools -y

: g+ H0 ]/ T$ j. ]3 U
nano 01-network-manager-all.yaml
4 x; W$ ^$ q9 u6 A  L6 l5 F2 L
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
, |% I; u$ B7 R9 K9 K
sudo netplan apply

. e  A( M" R+ A3 h  n* U8 x( m$ C! d8 {
**************************************************
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-17 16:09 , Processed in 0.089539 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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