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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2209|回复: 0

root 脚本

[复制链接]
发表于 2016-9-12 15:16:09 | 显示全部楼层 |阅读模式
#!/bin/bash
# U4 Z0 t9 x. j3 M& _0 z) e
#set root password
sudo passwd root

4 E' W8 F0 q: J- U4 u1 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
  A* N$ }& @* ~& _, g0 g
#modify profile
sudo sed -i 's/^mesg.*/tty -s \&\& mesg n \|\| true/' /root/.profile

& a% [; Y, q4 Z/ l6 q1 u  X
#install openssh
sudo apt install openssh-server

1 C2 B% E5 g3 s
#delay
sleep 1

$ }" W6 K. n: [' i/ W9 p
#modify conf
sudo sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config

" _% \( d4 T: T  S; B
#restart server
sudo systemctl restart ssh
" P$ `" ]. o( w9 P! }1 r" g  ~$ b, u
*******************************************************************************************

( W* F' [9 D/ Y" H' s
) ?7 u8 k$ H0 F  n6 X
修改固定IP

) Y) Z& Q: ]! Z+ @, x; V8 N' Z: b4 j
cd /etc/netplan/
sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.bak

& }/ N! _- C% ~! H0 {  y6 O
sudo apt update -y
sudo apt install net-tools -y

& R- E' l: m+ x3 v
nano 01-network-manager-all.yaml
! K0 _' i- e* j" x) w  }; i$ @
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 P( o& ^# P/ I1 o* |8 V0 ^
sudo netplan apply

/ a# T& ?' T2 x6 p; f2 f
**************************************************
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-4-20 14:10 , Processed in 0.097980 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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