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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2314|回复: 0

root 脚本

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

# k' E, u0 S7 n/ S0 o
#set root password
sudo passwd root
0 g# t* C8 {: o
#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
0 j3 X% x% E# b  P
#modify profile
sudo sed -i 's/^mesg.*/tty -s \&\& mesg n \|\| true/' /root/.profile
) v  e, }' j) y& v* C) _& D
#install openssh
sudo apt install openssh-server
- S1 C% `% ^: F6 N% g
#delay
sleep 1
% e  k: W/ B+ ?' q" E2 M0 ^& y6 N
#modify conf
sudo sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
+ B6 q: b; Q+ \  S* E
#restart server
sudo systemctl restart ssh
# A# I) Z) p, B  d  @+ n
*******************************************************************************************
" \# r' n8 b9 l- o* `% l8 z

- P; ~: g5 Y. F$ a: f( R6 D0 ^: _
修改固定IP
3 K4 G0 m3 f4 ]  S1 v- R
$ i! s. t, N/ c4 o
cd /etc/netplan/
sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.bak
+ }) ?7 [$ v# H! e( w
sudo apt update -y
sudo apt install net-tools -y
4 X2 h* Q6 E4 K% K1 o( ~
nano 01-network-manager-all.yaml

( A$ Z- M! {5 ?
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

( H) p0 k1 F2 m  E
sudo netplan apply
2 ]. u# a' v% i0 I
**************************************************
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-19 15:09 , Processed in 0.083201 second(s), 17 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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