Linux实战(14):Ubuntu修改root默认登陆
第一步
首先登录系统,创建root用户的密码
在终端输入命令:
sudo passwd root
然后输入设置的密码,这样就完成了设置root用户密码的步骤
第二步
修改文件
sudo nano /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf #管理员nano命令编辑'50-ubuntu.conf'
在文件末尾增加如下两行:
greeter-show-manual-login=true'
all-guest=false
如下:
[Seat:*]
user-session=ubuntu
greeter-show-manual-login=true
all-guest=false
第三步
修改
/etc/pam.d/gdm-autologin和 /etc/pam.d/gdm-password文件
sudo nano /etc/pam.d/gdm-autologin #管理员nano编辑'gdm-autologin'文件
注释掉auth required pam_succeed_if.so user != root quiet_success这一行(第三行左右)
文件配置可参考以下:
#%PAM-1.0
auth requisite pam_nologin.so
#auth required pam_succeed_if.so user != root quiet_success
auth optional pam_gdm.so
auth optional pam_gnome_keyring.so
auth required pam_permit.so
@include common-account
# SELinux needs to be the first session rule. This ensures that any
# lingering context has been cleared. Without this it is possible
# that a module could execute code in the wrong domain.
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so cl$
session required pam_loginuid.so
# SELinux needs to intervene at login time to ensure that the process
# starts in the proper default security context. Only sessions which are
# intended to run in the user's context should be run after this.
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so op$
session optional pam_keyinit.so force revoke
session required pam_limits.so
session required pam_env.so readenv=1
session required pam_env.so readenv=1 user_readenv=1 envfile=/etc/default/locale
@include common-session
session optional pam_gnome_keyring.so auto_start
@include common-password
sudo nano /etc/pam.d/gdm-password #管理员nano编辑'gdm-password'文件
注释掉 auth required pam_succeed_if.so user != root quiet_success这一行(第三行左右)
文件配置可参考以下:
#%PAM-1.0
auth requisite pam_nologin.so
#auth required pam_succeed_if.so user != root quiet_success
@include common-auth
auth optional pam_gnome_keyring.so
@include common-account
# SELinux needs to be the first session rule. This ensures that any
# lingering context has been cleared. Without this it is possible
# that a module could execute code in the wrong domain.
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so cl$
session required pam_loginuid.so
# SELinux needs to intervene at login time to ensure that the process
# starts in the proper default security context. Only sessions which are
# intended to run in the user's context should be run after this.
session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so op$
session optional pam_keyinit.so force revoke
session required pam_limits.so
session required pam_env.so readenv=1
session required pam_env.so readenv=1 user_readenv=1 envfile=/etc/default/locale
@include common-session
session optional pam_gnome_keyring.so auto_start
@include common-password
第四步
修改/root/.profile文件
sudo nano /root/.profile #管理员nano编辑'.profile'文件
将文件末尾的mesg n || true这一行修改成
tty -s&&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
#mesg n || true
第五步
sudo gedit /etc/ssh/sshd_config #管理员nano编辑'sshd_config'文件
在 #PermitRootLogin prohibit-password
下添加:PermitRootLogin yes
文件配置可参考以下:
# $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
# default value.
#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key
# Ciphers and keying
#RekeyLimit default none
# Logging
#SyslogFacility AUTH
#LogLevel INFO
# Authentication:
#LoginGraceTime 2m
#PermitRootLogin prohibit-password
最后重启系统
Linux实战(14):Ubuntu修改root默认登陆的更多相关文章
- Ubuntu无法使用root用户登陆的解决办法
对于一个新安装的Ubuntu操作系统,经常会遇到无法使用root用户ssh连接操作系统,比如说root用户的密码被拒绝等原因. 面对这种问题,介绍一下Ubuntu无法使用root登陆解决 1. 修改 ...
- mysql5.7.11修改root默认密码
知道 MySQL 出了5.7了,并且网上说性能提高了一两倍,于是在虚拟机上安装了个 CentOS 7,在上面安装 MySQL 5.7 我使用的是 yum安装方式,要求虚拟机能够上网,因为它会在线下载安 ...
- mysql5.7系列修改root默认密码
操作系统为centos7 64 1.修改 /etc/my.cnf,在 [mysqld] 小节下添加一行:skip-grant-tables=1 这一行配置让 mysqld 启动时不对密码进行验证 2. ...
- linux 登录失败,修改root密码
开机按下 esc 重启系统后出现GRUB界面在引导装载程序菜单上,用上下方向键选择你忘记密码的那个系统键入“e” 来进入编辑模式. 接下来你可以看到如下图所示的画面,然后你再用上下键选择最新 ...
- 【Linux】Ubuntu修改root用户密码
使用vmware安装ubuntu的时候,安装完之后发现没有root用户密码,只有新建用户,这个时候需要重新设置root用户密码 在新建用户下面运行 sudo passwd root
- linux修改root用户登陆密码
如果不是以root用户登录的,请先切换到root用户下, 执行命令:su root 然后按提示输入root用户的密码. 英文系统: [root@localhost ~]# passwd Changin ...
- (转)Linux SSH配置和禁止Root远程登陆设置
原文 一.修改vi /etc/ssh/sshd_config 文件 1.修改默认端口:默认Port为22,并且已经注释掉了:修改是把注释去掉,并修改成其它的端口. 2.禁止root用户远程登陆:修改P ...
- Ubuntu修改mysql默认编码的方法
ubuntu使用apt-get安装mysql后,server的默认编码是latin1,下面把server的编码修改成utf8. 编码相关信息: 1 2 3 4 5 6 7 8 9 10 11 12 1 ...
- ubuntu 修改root密码
重新安装过ubuntu 14.04后,切换到root权限,需要输入密码,输入n次都不对. 也没有记得设置过密码. 百度一下,得到方法如下,已经验证测试成功. 命令为: sudo passwd 提示输入 ...
随机推荐
- vue2.0从头开发项目管理系统
1.自己的github建一个项目. 2.本地vue2.0项目初始化. 安装node.js,检查node版(node -v). 安装webpack(npm install webpack -g),检查w ...
- 7、TypeScript类型、接口、类、泛型综合使用 -- TypeScript封装统一操作Mysql Mongodb Mssql的底层类库。
功能:定义一个操作数据库的库,支持Mysql Mssql Mongodb 要求:Mysql Mssql Mongodb功能一样 都有add.update.delete.get方法 注意:约束统一的规范 ...
- NameNode和SecondaryNameNode(面试开发重点)
NameNode和SecondaryNameNode(面试开发重点) 1 NN和2NN工作机制 思考:NameNode中的元数据是存储在哪里的? 首先,我们做个假设,如果存储在NameNode节点的磁 ...
- python setup.py install 报错【Project namexxx was given, but was not able to be found.】
错误信息: [root@wangjq networking-mirror]# python setup.py install /usr/lib64/python2./distutils/dist.py ...
- 使用Spring Cloud Config统一管理配置,别再到处放配置文件了
1 前言 欢迎访问南瓜慢说 www.pkslow.com获取更多精彩文章! 可配置是一个成熟软件系统应该提供的特性,而配置管理对于大型系统就显得十分重要,特别是对于拥有多个应用的微服务系统.可喜的是, ...
- Java基础的基础,花1h看这一篇就够了!
------------恢复内容开始------------ Java笔记 一直以来,总想着Java会点基础就可以写后端程序了,但越到后来越发现Java基础的重要性.更不必说在面试时,Java基础 ...
- C语言基础练习——打印菱形
C语言基础练习--打印菱形 JERRY_Z. ~ 2020 / 8 / 26 转载请注明出处! 代码: /* * @Author: JERRY_Z. * @Date: 2020-08-26 17:17 ...
- Htmlcss学习笔记2——选择器与常用样式
CSS引入类型 行内样式 内联样式 外部样式表 CSS选择器 基本选择器 复合选择器 伪类选择器 属性选择器 CSS字体样式 font-size font-family font-style font ...
- e3mall商城的归纳总结9之activemq整合spring、redis的缓存
敬给读者 本节主要给大家说一下activemq整合spring,该如何进行配置,上一节我们说了activemq的搭建和测试(单独测试),想看的可以点击时空隧道前去查看.讲完了之后我们还说一说在项目中使 ...
- CocosCreator游戏开发(五)实现技能按钮
在上一篇中,已经顺利的实现了通过摇杆控件来控制角色移动的例子 这一篇内容中,主要来实现通过摇杆来操作技能施法位置的功能 代码效果如下: 在最初的想法中,我是想将摇杆与技能施法范围以及施法位置做成一个组 ...