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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1662|回复: 0

root 脚本

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

! ^3 k# R, y5 R3 J
#set root password
sudo passwd root
' D; F) @, x" R7 ]
#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

5 r2 J0 v' {* u  e
#modify profile
sudo sed -i 's/^mesg.*/tty -s \&\& mesg n \|\| true/' /root/.profile
2 G* e% H  i, M) P' p* q! G$ a1 n
#install openssh
sudo apt install openssh-server

1 `! e  i) W6 x
#delay
sleep 1

. e# S0 I& y: m, \' o& S3 |
#modify conf
sudo sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config

& p4 L3 d. S5 u+ }. L
#restart server
sudo systemctl restart ssh
2 @: x  i; v1 O2 R/ L2 l
*******************************************************************************************

, Q; a+ ~1 n" U* g- w$ \- ?( P9 N' r9 J; b; K/ r
修改固定IP
! Z- N7 U9 O3 Y9 z9 r

# C1 ]1 J/ m; v
cd /etc/netplan/
sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.bak

. k: {" X, S% J4 u8 t
sudo apt update -y
sudo apt install net-tools -y

7 S1 |% @) R/ Z: n3 W5 t
nano 01-network-manager-all.yaml

, ]# p* m3 y  \
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
% ^* ~7 {& B2 W1 t' N) g
sudo netplan apply
& K5 h) ~; v" V. g9 \
**************************************************
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-19 19:18 , Processed in 0.171220 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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