Ubuntu相关

Ubuntu18.04 关闭和开启图形界面

  1. 关闭用户图形界面

    1
    2
    sudo systemctl set-default multi-user.target
    sudo reboot
  2. 开启用户图形界面

    1
    2
    sudo systemctl set-default graphical.target
    sudo reboot

openssh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
apt-get install openssh-server

修改配置文件: /etc/ssh/sshd_config

找到

# Authentication:
LoginGraceTime 120
PermitRootLogin prohibit-password
StrictModes yes
更改为

# Authentication:
LoginGraceTime 120
#PermitRootLogin prohibit-password
PermitRootLogin yes
StrictModes yes
重启ssh服务

sudo service ssh restart

关闭防火墙

1
ufw disable

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
开机自动启动ssh命令
sudo systemctl enable ssh

关闭ssh开机自动启动命令
sudo systemctl disable ssh

单次开启ssh
sudo systemctl start ssh

单次关闭ssh
sudo systemctl stop ssh

设置好后重启系统
reboot

#查看ssh是否启动,看到Active: active (running)即表示成功
sudo systemctl status ssh