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 提示输入 ...
随机推荐
- troubleshoot之:使用JFR分析性能问题
目录 简介 GC性能事件 同步性能 IO性能 代码执行的性能 其他有用的event 简介 java程序的性能问题分析是一个很困难的问题.尤其是对于一个非常复杂的程序来说,分析起来更是头疼. 还好JVM ...
- ganglia访问时出现"You don't have permission to access /ganglia/ on this server"
安装ganglia后,访问浏览器出现"You don't have permission to access /ganglia/ on this server" 按照网络上的要求配 ...
- 6.oracle用户管理口令
一.使用profile管理用户口令概述:profile是口令限制,资源限制的命令集合,当建立数据库时,oracle会自动建立名称为default的profile.当建立用户没有指定profile选项时 ...
- 第2章 Hive安装
第2章 Hive安装 2.1 Hive安装地址 1.Hive官网地址 http://hive.apache.org/ 2.文档查看地址 https://cwiki.apache.org/conflue ...
- linux 查看系统页大小
X86: [root@wangjq ~]# getconf PAGESIZE ARM: root@controller:~# getconf PAGESIZE
- classmethod与staticmethod
1.classmethod @classmethod # 把一个对象绑定的方法 修改成一个 类方法第一,在方法中仍然可以引用类中的静态变量第二,可以不用实例化对象,就直接用类名在外部调用这个方法什 ...
- 【Flutter 实战】自定义动画-涟漪和雷达扫描
老孟导读:此篇文章是 Flutter 动画系列文章第五篇,本文介绍2个自定义动画:涟漪和雷达扫描效果. 涟漪 实现涟漪动画效果如下: 此动画通过 CustomPainter 绘制配合 Animatio ...
- Vue + axios + SpringBoot 2实现导出Excel
Vue + axios + SpringBoot 2实现导出Excel 1. 前端js代码-发送Http请求 /** * 文件下载 * @param url 下载地址 * @param fileNam ...
- 要不是真的喜欢学技术,谁会来用Python爬小姐姐啊
养成习惯,先赞后看!!!不用于任何商业价值,只是自己娱乐.否则 爬虫爬的好,牢饭吃到饱.这是我们这次爬取的网址:https://www.vmgirls.com/ 很多人学习python,不知道从何学起 ...
- 《神经网络的梯度推导与代码验证》之FNN(DNN)的前向传播和反向推导
在<神经网络的梯度推导与代码验证>之数学基础篇:矩阵微分与求导中,我们总结了一些用于推导神经网络反向梯度求导的重要的数学技巧.此外,通过一个简单的demo,我们初步了解了使用矩阵求导来批量 ...