我的.profile文件中包含以下脚本:
systemctl is-active --quiet lightdm && (
echo Welcome to Terminal) || (
sleep 8
startx)
fi
目的是,如果gui尚未运行,它将启动GUI。但是从来没有。它甚至从未说过欢迎来到Terminal。
编辑:我尝试使用添加规则到/ etc / sudoers,但它不会更改提示。这是文件中包含的内容:
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
lukaka ALL = NOPASSWD: /usr/sbin/service lightdm *
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
添加到~/.profile
文件末尾:
systemctl is-active --quiet lightdm && {
echo 'Welcome to Terminal'
} || {
echo 'Starting Desktop GUI in 8 seconds... Press Ctrl-c to abort'
sleep 8
sudo systemctl start lightdm
}
如果您的LinuxMint已设置为引导到控制台而不是桌面,那么在登录到您的帐户后,您将看到以下消息:
8秒钟内启动桌面GUI ...按Ctrl-c中止
要中断桌面加载,请按-Ctrl+c否则,系统会要求您输入密码,如果您通过授权,则会启动桌面GUI。
如果您已经加载了桌面并启动了终端程序,它将显示欢迎消息:
欢迎来到码头
聚苯乙烯
如果您不想提供sudo
自动启动桌面的密码,请执行以下操作:
1.运行sudo visudo
并提供您的密码。
2.如果您不想sudo
到处都用密码打扰您,请
添加到文件末尾:(用您的实际用户名代替YourUserName)
YourUserName ALL=(ALL) NOPASSWD: ALL
并保存它。
否则,您可以sudo
使用以下行中的以下行来绕过仅输入密码才能启动桌面的要求visudo
:
YourUserName ALL = NOPASSWD: /usr/sbin/service lightdm *
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句