Ubuntu18.04 tips for the basic configuration of the new machine SSL remote root link

Environment preparation Ubuntu 18.04


Ubuntu start service systemctl start service name


The cloned Ubnutu gets root privileges

  • 1. First
sudo passwd root
  • Enter the root password twice

Allow remote login using root user

(1) Query whether the ssh service is enabled in the system

(2) If it is not turned on, try to execute the /etc/init.d/ssh start command

(3) If there is no such command, it means that openssh-server is not installed and
execute apt-get install openssh-server (normal user plus sudo to execute), and then execute the command to enable ssh service after installation.
(4) At this time, we use xshell as root user or If you cannot log in, you need to modify the /etc/ssh/sshd_config file

#执行 
vim /etc/ssh/sshd_config
#找到
#LoginGraceTime 120
#PermitRootLogin prohibit-password
#StrictModes yes

#改成如下:
#解开掉注释
#Authentication:
 
LoginGraceTime 120
 
PermitRootLogin yes
 
StrictModes yes

(5) Then exit vim editing and enter the command

/etc/init.d/ssh restart 

Restart the ssh service.


3. Modify the host name

1. Modify cloud.cfg to prevent hostname restoration after restart

vi /etc/cloud/cloud.cfg
  1. This configuration is false by default, just modify it to true
preserve_hostname: true

3. Modify the host name

hostnamectl set-hostname 主机名

6. Restart the computer

reboot

Modify IP

vi editor paste

先按 Esc 冒号: 输入 set paste 回车再进行粘贴
否则yml格式会错乱

Just to facilitate future connections to prevent dbcp from randomly assigning ip

  • 1. Take root privileges
  • 2. Modify vim /etc/netplan/50-cloud-init.yaml
  • 3. Delete all content written

vim /etc/netplan/50-cloud-init.yaml

network:
   version: 2
   renderer: networkd
   ethernets:
     ens33:
      addresses:    
            - 192.168.244.101/24
      gateway4: 192.168.244.2
      nameservers:
          addresses: [8.8.8.8,1.1.1.1]

  • 4. Restart the network service netplan apply

Guess you like

Origin blog.csdn.net/weixin_43420255/article/details/105914274