找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2466|回复: 0

root 脚本

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

7 N  T. S' T! o. U7 a- O
#set root password
sudo passwd root
' s9 V/ V- Q' n2 W) a( [9 n
#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
  q( ]% t1 E# W
#modify profile
sudo sed -i 's/^mesg.*/tty -s \&\& mesg n \|\| true/' /root/.profile
: f7 k% [$ g4 o: j3 L4 j9 D6 Q
#install openssh
sudo apt install openssh-server

( [' p: l* R# V* x
#delay
sleep 1

: F7 l' ^  l0 F/ C, @  b) ^
#modify conf
sudo sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config

5 `8 I* X! X; r, G$ O
#restart server
sudo systemctl restart ssh
5 N5 B" ~) b! y" l. l7 c1 P
*******************************************************************************************

/ `1 x9 s6 p+ ^) H) }
- G3 r. z* z3 m. s
修改固定IP
1 T" i/ F& b+ n5 h) e5 X
6 w% D4 [+ Q$ H5 D. h% A5 c0 c
cd /etc/netplan/
sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.bak
$ J- H: L+ d1 t- }5 H1 }$ w7 p
sudo apt update -y
sudo apt install net-tools -y
$ c) L, W1 l2 j& x  Q, Q: `
nano 01-network-manager-all.yaml

/ A: P% r, d! i& p0 |8 H' {
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
# c1 E3 a- u* B3 a; O: j
sudo netplan apply
/ T3 G6 z5 b4 M" z: D+ |
**************************************************
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-8-14 03:50 , Processed in 0.078146 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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