找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2467|回复: 0

root 脚本

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

7 U: t+ x$ F0 b  {5 W" a& r
#set root password
sudo passwd root
2 e; b% Z/ J1 y3 t; n: W3 s, v, i/ ?- |
#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 w( F# I6 Y* i$ O" Y1 k
#modify profile
sudo sed -i 's/^mesg.*/tty -s \&\& mesg n \|\| true/' /root/.profile

" q4 d" \' {1 F( @
#install openssh
sudo apt install openssh-server

$ v8 }7 F" H$ w. t5 m$ [
#delay
sleep 1

9 e' v! P8 P: a1 z
#modify conf
sudo sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
- R" w( _& j$ N, A' h
#restart server
sudo systemctl restart ssh

* T% w. W) b/ U: W. u" d
*******************************************************************************************

% _1 k6 v4 ^; N+ X0 m  B) n8 t( D0 P
修改固定IP

0 p" T/ V$ Q8 m/ u6 c5 |" Q
7 f" b% u$ ]! U4 S
cd /etc/netplan/
sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.bak

. X+ d8 z2 G  a( O: ~2 N
sudo apt update -y
sudo apt install net-tools -y
+ _+ j! f$ e' D1 v* s
nano 01-network-manager-all.yaml
* E6 a, D9 ?( q
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
" q$ F7 \  ^5 c( n6 h- n3 H' V$ {
sudo netplan apply

, E7 ?2 B$ q  W! t7 ?
**************************************************
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-8-14 05:26 , Processed in 0.039711 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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