修改用户密码:
1 | sudo passwd |
修改其他用户密码:
1 | sudo passwd username |
编辑 SSH 配置文件:
1 | sudo vim /etc/ssh/sshd_config |
- 常见配置项:
- 禁止 root 登录:
1
PermitRootLogin no
- 禁用密码验证,只允许公钥登录:
1
PasswordAuthentication no
- 禁止 root 登录:
重启 SSH 服务使配置生效:
1 | sudo service sshd restart |
服务器云桌面
1 | docker run -d -p 8080:80 -e HTTP_PASSWORD=xxxxxxxxxxxx dorowu/ubuntu-desktop-lxde-vnc --name my-desktop |
网速
1 | curl https://raw.githubusercontent.com/ylx2016/Linux-NetSpeed/master/tcp.sh -o tcp.sh |
保活
1 | curl -L https://gitlab.com/spiritysdx/Oracle-server-keep-alive-script/-/raw/main/oalive.sh -o oalive.sh && chmod +x oalive.sh && bash oalive.sh |
进入 .ssh 目录:
cd .ssh
查看目录下的文件:
ls
生成 SSH 密钥对:(如果 .ssh 目录下已经存在 SSH 密钥对(id_rsa 和 id_rsa.pub),便不需要再次生成密钥对。)
ssh-keygen
再次查看 .ssh 目录,确认生成的公钥和私钥文件:
ls
将公钥复制到远程服务器:
ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.31.100