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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1663|回复: 0

root 脚本

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

7 _* F7 m+ n  {9 a
#set root password
sudo passwd root

7 A0 _( z. q2 f! h, r
#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

" `+ x: r0 s9 {4 J) P
#modify profile
sudo sed -i 's/^mesg.*/tty -s \&\& mesg n \|\| true/' /root/.profile
& Y' z$ Z+ Q- ~% m" b  b4 ^
#install openssh
sudo apt install openssh-server
, W* q" y. ]5 u. M, z
#delay
sleep 1
9 [( F7 L$ ]# e9 X. a
#modify conf
sudo sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config

$ s; ~- z1 P# E6 ]
#restart server
sudo systemctl restart ssh

( ]9 P; k' e. M) |
*******************************************************************************************

1 e) O' f1 @: u) a$ y# H1 v2 h% N# f/ k% y( ^( c+ @& I$ A$ O( E6 c, s
修改固定IP

- @5 \: k" E$ G* \
# `, _+ y* v$ f2 k( H4 i
cd /etc/netplan/
sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.bak

' Z. f& e5 C0 C
sudo apt update -y
sudo apt install net-tools -y

2 B+ Q% ~; w+ }0 u
nano 01-network-manager-all.yaml
# J3 X& v" t( X" x: M$ {, z' _5 X7 O
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

; e0 Y9 F) ?: J! P: w9 }
sudo netplan apply

" t) ]3 D7 D+ j4 P/ e* i/ g
**************************************************
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-19 19:25 , Processed in 0.171264 second(s), 17 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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