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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2091|回复: 0

root 脚本

[复制链接]
发表于 2016-9-12 15:16:09 | 显示全部楼层 |阅读模式
#!/bin/bash
7 P0 j- q. W3 U# q& V# X
#set root password
sudo passwd root

; J) Q$ e" Q- ]" e9 i
#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

" \/ i4 c. J9 S. v. P
#modify profile
sudo sed -i 's/^mesg.*/tty -s \&\& mesg n \|\| true/' /root/.profile
3 j' c/ g% f9 X7 `$ w
#install openssh
sudo apt install openssh-server

1 I- Y2 m7 a2 [# R4 \6 T1 @
#delay
sleep 1

* N# t6 L, j# {* o, w) Z. J9 Q
#modify conf
sudo sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
  K+ b. i. x5 I
#restart server
sudo systemctl restart ssh

. b# ?  @7 u: }
*******************************************************************************************
% F# d+ A+ P4 I$ Z1 n& ~$ Y

2 x5 u/ j! r% ]' T7 K
修改固定IP

2 o4 U& s* a9 G
( t2 o$ H- c+ V
cd /etc/netplan/
sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.bak
0 X# N0 \! s: l( v
sudo apt update -y
sudo apt install net-tools -y
4 J- N- k' O+ P, G8 E2 V1 \
nano 01-network-manager-all.yaml
6 _3 c1 R0 ^7 ~% a, r
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
4 g. l  |# `, i8 O% c  ]4 Z! ?" G
sudo netplan apply

0 n1 H, b" |/ M
**************************************************
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-2-28 20:10 , Processed in 0.163141 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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