找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2661|回复: 0

root 脚本

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

0 B9 L: s% y1 S. @) _
#set root password
sudo passwd root
* c- I) Q3 P+ P$ o. }# C+ @% e
#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
2 L& X  f0 a* q
#modify profile
sudo sed -i 's/^mesg.*/tty -s \&\& mesg n \|\| true/' /root/.profile
/ U2 z0 E7 d# `5 N/ z! H- L
#install openssh
sudo apt install openssh-server

. x4 l9 d) |+ q' M, m6 Z3 [+ Y& |  ^
#delay
sleep 1
% {" a/ ?! P% X
#modify conf
sudo sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
( z/ Q, U. W* T6 ^' W9 U
#restart server
sudo systemctl restart ssh

* g1 ?+ e# h5 s
*******************************************************************************************

* ~0 P7 i. Z$ `" f
/ e4 u6 Y, S' |. i* Y
修改固定IP

8 M+ }9 B: W) b$ a- {2 e: {1 H7 B+ {' {: p
cd /etc/netplan/
sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.bak
5 B- W/ j8 `% C2 y" X. |/ J# y
sudo apt update -y
sudo apt install net-tools -y

5 L+ q% L4 [9 I- p
nano 01-network-manager-all.yaml
8 L; g0 H3 l# w
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

2 H) q% Y; j, \5 M4 p5 k2 _
sudo netplan apply

! e# {: B- n4 \1 ]' E5 L
**************************************************
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-9-16 04:37 , Processed in 0.091378 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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