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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2210|回复: 0

root 脚本

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

6 u' u' }/ ?( r% U: @% T
#set root password
sudo passwd root
- S' n2 N& I9 e+ q1 J
#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

9 n; S8 q9 K7 L' b9 D! k) z
#modify profile
sudo sed -i 's/^mesg.*/tty -s \&\& mesg n \|\| true/' /root/.profile

) B  j( I- U( \9 s# m3 h+ F
#install openssh
sudo apt install openssh-server

% ?7 c3 T  ^+ M7 m/ L! S9 a, {( Y2 I# ]
#delay
sleep 1

0 n$ W" d! n+ }& _/ Z
#modify conf
sudo sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config

; l" U+ i# m: @0 c( n. z+ e4 S
#restart server
sudo systemctl restart ssh

% u# w0 i" i8 x
*******************************************************************************************

! ^* L/ y3 K; W4 t0 t, g, b: V2 h
修改固定IP

1 J& c5 f" j. b
8 u6 W9 V$ F4 Z) g" }
cd /etc/netplan/
sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.bak

; M4 `" B& D3 s: p; n: ?
sudo apt update -y
sudo apt install net-tools -y

9 s+ u( b( _( r; `
nano 01-network-manager-all.yaml

5 S; F( @1 z8 Z
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
& x. b; I. o8 L4 ?" l$ B" E
sudo netplan apply

/ V; d2 Z# A$ E& Y, x# P# e
**************************************************
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-4-20 17:03 , Processed in 0.107243 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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