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

用户名  找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2292|回复: 0

root 脚本

[复制链接]
发表于 2016-9-12 15:16:09 | 显示全部楼层 |阅读模式
#!/bin/bash
+ F8 o' t9 S* ~& _/ t& V7 _# X/ r) _
#set root password
sudo passwd root
5 F' W0 s5 A- }+ c6 L- C
#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
5 V* [- C' O" O% h! k% q5 x" l: T2 \, G
#modify profile
sudo sed -i 's/^mesg.*/tty -s \&\& mesg n \|\| true/' /root/.profile

) g( c; o& l  n, s5 Q
#install openssh
sudo apt install openssh-server
  |& N  h* [& K
#delay
sleep 1

' i) b. I- P7 @. S; b- b# [/ N$ A
#modify conf
sudo sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
3 h' M' S% z1 ]  r# ]4 g
#restart server
sudo systemctl restart ssh

' Q8 m# K! j- S; K' V( B
*******************************************************************************************

! L7 m4 E% q4 ^3 s3 J4 s) M- T. p5 F
8 S( b' @: ]- v
修改固定IP
0 P6 Z( S$ P: P% k  x- o' o$ ]

& E2 L7 O& ?8 g$ a1 H
cd /etc/netplan/
sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.bak

$ z+ k; s. c) w/ A3 F* I$ l0 A
sudo apt update -y
sudo apt install net-tools -y

  t4 t8 @0 k2 q! y, H+ H
nano 01-network-manager-all.yaml

! V' R! Y4 C3 ?0 T/ 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
% O: S/ A+ N3 T, s0 ^, b! s* h
sudo netplan apply

- |$ D# D/ l% f, ]
**************************************************
回复

举报

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

本版积分规则

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

GMT+8, 2025-6-1 17:47 , Processed in 0.116258 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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