Ubuntu20 普通设置
ubuntu20 使用root 登录
第一步:
以普通用户登录系统,创建root用户的密码
在终端输入命令:
sudo passwd root
然后输入设置的密码,输入两次,这样就完成了设置root用户密码了
第二步:
修改文件sudo gedit /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
在文件末尾增加如下两行:
greeter-show-manual-login=true
all-guest=false
第三步:
修改 /etc/pam.d/gdm-autologin
/etc/pam.d/gdm-password
两个文件
sudo gedit /etc/pam.d/gdm-autologin
注释掉auth required pam_succeed_if.so user != root quiet_success这一行(第三行左右)
sudo gedit /etc/pam.d/gdm-password
注释掉 auth required pam_succeed_if.so user != root quiet_success这一行(第三行左右)
第四步:
修改/root/.profile文件
sudo gedit /root/.profile
将文件末尾的mesg n 2> /dev/null || true这一行修改成
tty -s&&mesg n || true
部分没有,可以不用修改本文来自
启用SSH
Secure Shell(SSH)是用于客户端和服务器之间安全连接的网络协议。服务器与客户端之间的每次交互均被加密。
本教程说明了如何在Ubuntu计算机上启用SSH。
启用SSH将允许您远程连接到系统并执行管理任务。您还可以通过scp
和sftp
安全地传输文件。
在Ubuntu上启用SSH
默认情况下,首次安装Ubuntu时,不允许通过SSH进行远程访问。在Ubuntu上启用SSH非常简单。
以root 用户或具有sudo特权的用户执行以下步骤,以在Ubuntu系统上安装并启用SSH:
使用打开终端Ctrl+Alt+T
并安装openssh-server
软件包:
<pre class="language-markup">```
sudo apt update
sudo apt install openssh-server
出现提示时,输入密码,然后按Enter继续安装。
安装完成后,SSH服务将自动启动。您可以通过键入以下命令来验证SSH是否正在运行:
``` sudo systemctl status ssh ``` ```
输出应告诉您该服务正在运行,并已启用以在系统引导时启动:
```
``` ● ssh.service - OpenBSD Secure Shell server Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2020-06-01 12:34:00 CEST; 9h ago … ```
```
按q
返回到命令行提示符。
Ubuntu随附了一个名为UFW的防火墙配置工具。如果在系统上启用了防火墙,请确保打开SSH端口:
```
\`\`\` sudo ufw allow ssh \`\`\` \`\`\` 现在,您可以从任何远程计算机通过SSH连接到Ubuntu系统。Linux和macOS系统默认安装了SSH客户端。要从Windows计算机连接,请使用SSH客户端(例如PuTTY)。 ## 连接到SSH服务器 要通过LAN连接到Ubuntu计算机,请调用ssh命令,然后输入用户名和IP地址,格式如下: \`\`\` \`\`\` ssh username@ip\_address \`\`\` \`\`\` > 确保`username`使用实际用户名和`ip_address`安装SSH的Ubuntu计算机的IP地址进行更改。 如果您不知道IP地址,则可以使用以下`ip`命令轻松找到它: \`\`\`\`\`\` ip a \`\`\` \`\`\` !\[\](http://iplayio-cn.litchilab.com/FuJLCLH-IYh0pNq-hVJxyT86UdWR)从输出中可以看到,系统IP地址为\`10.0.2.15\`。 找到IP地址后,通过运行以下\`ssh\`命令登录到远程计算机: \`\`\` \`\`\` ssh linuxize@10.0.2.15 \`\`\` \`\`\` 首次连接时,您会看到如下消息: \`\`\`\`\`\` The authenticity of host '10.0.2.15 (10.0.2.15)' can't be established. ECDSA key fingerprint is SHA256:Vybt22mVXuNuB5unE++yowF7lgA/9/2bLSiO3qmYWBY. Are you sure you want to continue connecting (yes/no)? \`\`\` \`\`\` 键入\`yes\`你会被提示输入您的密码。 \`\`\` \`\`\` Warning: Permanently added '10.0.2.15' (ECDSA) to the list of known hosts. linuxize@10.0.2.15's password: \`\`\` \`\`\` 输入密码后,将收到默认的Ubuntu消息: \`\`\`\`\`\` Welcome to Ubuntu 20.04 LTS (GNU/Linux 5.4.0-26-generic x86\_64) \* Documentation: https://help.ubuntu.com \* Management: https://landscape.canonical.com \* Support: https://ubuntu.com/advantage ... \`\`\` \`\`\` 现在,您已登录到Ubuntu计算机。 ## 在NAT后连接到SSH 要通过Internet连接到您的家用Ubuntu计算机,您需要知道您的公共IP地址,并将路由器配置为接受端口22上的数据,并将其发送到运行SSH的Ubuntu系统。 要确定你想SSH到机器的公网IP地址,只需访问以下网址:\[\](https://www.baidu.com/s?wd=ip)\[https://www.baidu.com/s?wd=ip\](https://www.baidu.com/s?wd=ip)。 在设置端口转发时,每个路由器都有不同的方式来设置端口转发。您应该查阅路由器文档,以了解如何设置端口转发。简而言之,您需要输入进行请求的端口号(默认SSH端口为22)和您先前\`ip a\`在运行SSH的计算机上找到的私有IP地址(使用命令)。 找到IP地址并配置路由器后,您可以通过输入以下内容登录: \`\`\` \`\`\` ssh username@public\_ip\_address \`\`\` \`\`\` 如果要将计算机暴露在Internet上,则最好实施一些安全措施。最基本的方法是将路由器配置为在非标准端口上接受SSH流量,并将其转发到运行SSH服务的计算机上的端口22。 您还可以设置基于SSH密钥的身份验证并连接到Ubuntu计算机,而无需输入密码。 ## 在Ubuntu上禁用SSH 要在您的Ubuntu系统上禁用SSH服务器,只需运行以下命令即可停止SSH服务: \`\`\`\`\`\` sudo systemctl disable --now ssh \`\`\` \`\`\` 稍后,要重新启用它,请输入: ## `sudo systemctl enable --now ssh` \*\*其他\*\* ## \`\` apt-get update 基础教程参考:\[https://www.uud.me/qiwenzalun/autorclone-gclone.html\](https://www.uud.me/qiwenzalun/autorclone-gclone.html)Root/Admin Password: ax7rMSbB03sO9QZ21g sudo gedit /etc/ssh/sshd\_config 1、安装必要 apt-get update sudo apt-get install screen git && curl \[https://rclone.org/install.sh\](https://rclone.org/install.sh) | sudo bash apt-get install git python3 python3-pip -y sudo git clone \[https://github.com/xyou365/AutoRclone\](https://github.com/xyou365/AutoRclone) && cd AutoRclone && sudo pip3 install -r requirements.txt apt-get install sudo debian apt-get install curl apt-get install screen 2、开启Drive API 并下载 credentials.json \[https://developers.google.com/drive/api/v3/quickstart/python\](https://developers.google.com/drive/api/v3/quickstart/python) 3、将credentials.json保存到AutoRclone目录下面 把credentials.json上传gd,获取共享连接 生成直连 \[https://drive.google.com/uc?id=1clCV3itLBTGo2cjUhNYQQJAdIdiNTbHy&export=download\](https://drive.google.com/uc?id=1clCV3itLBTGo2cjUhNYQQJAdIdiNTbHy&export=download) \[https://drive.google.com/file/d/\](https://drive.google.com/file/d/) 1clCV3itLBTGo2cjUhNYQQJAdIdiNTbHy /view?usp=sharing wget 下载直连,并文件改名 wget \[https://drive.google.com/uc?id=替换id&export=download\](https://drive.google.com/uc?id=替换id&export=download)mv 下载文件名 credentials.json mv \\'uc?id=1clCV3itLBTGo2cjUhNYQQJAdIdiNTbHy\\' credentials.json \\'uc?id=1clCV3itLBTGo2cjUhNYQQJAdIdiNTbHy\\' 4 生产 sa python3 gen\_sa\_accounts.py --quick-setup 1 python3 gen\_sa\_accounts.py --quick-setup 2 --new-only 5、安装gclone bash
- 原文作者:zhoujie
- 原文链接:/archives/1797.html
- 版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议. 进行许可,非商业转载请注明出处(作者,原文链接),商业转载请联系作者获得授权。