#!/bin/bash # 更新软件库 apt-get update # 升级软件 apt-get upgrade # 安装ubuntu桌面系统 apt-get install ubuntu-desktop
重启之后,桌面环境就安装好了,但是远程连接进去,发现只能使用guest帐号,不能选择其他用户,而且不需要密码就能登录,登录进去还会有个警告信息!但是guest帐号地位太低了,几乎没什么权力。
我们需要进入服务器后台,修改root权限,修改 /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf 文件。
这个地方尤其需要注意:因为远程进入阿里云服务器,只能使用guest帐号,但是guest帐号是没有权限修改这个文件的。所以,我们需要在windows端,使用上面提到的putty工具,以root帐号(使用putty工具进入可以指定登录用户),远程登录进入,这样就可以修改这个文件了。
vi操作可以参考这个文章:https://www.cnblogs.com/doseoer/p/6241443.html
# 文件 /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf # 修改前 [Seat:*] user-session=ubuntu # 修改后 [Seat:*] user-session=ubuntu greeter-show-manual-login=true allow-guest=false
# 文件 /root/.profile # 文件修改前 # ~/.profile: executed by Bourne-compatible login shells. if [ "$BASH" ]; then if [ -f ~/.bashrc ]; then . ~/.bashrc fi fi mesg n || true # 文件修改后 # ~/.profile: executed by Bourne-compatible login shells. if [ "$BASH" ]; then if [ -f ~/.bashrc ]; then . ~/.bashrc fi fi tty -s && mesg n || true