PermitRootLogin是基于UID还是用户名?

PermitRootLogin是基于UID还是用户名?Sometimesitisfuntodigabitdeeperintohowthingsworkjusttosatisfyyourcuriositywhilelearningsomethingnew,likePermitRootLogin,forexample.DoesitchecktheUIDortheusername?Tod…

大家好,又见面了,我是你们的朋友全栈君。

is-permitrootlogin-based-on-the-uid-or-the-user-name-00

Sometimes it is fun to dig a bit deeper into how things work just to satisfy your curiosity while learning something new, like PermitRootLogin, for example. Does it check the UID or the user name? Today’s SuperUser Q&A post digs in to find the answer to a curious reader’s question.

有时,在学习诸如PermitRootLogin之类的新知识的同时,更深入地研究事物的工作方式只是为了满足您的好奇心是很有趣的。 是否检查UID或用户名? 今天的“超级用户问答”帖子深入探讨了对好奇的读者问题的答案。

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

今天的“问答”环节由SuperUser提供,它是Stack Exchange的一个分支,该社区是由社区驱动的Q&A网站分组。

问题 (The Question)

SuperUser reader ge0rg wants to know if PermitRootLogin is based on the UID or the user name:

超级用户阅读器ge0rg想知道PermitRootLogin是基于UID还是用户名:

The man page states that PermitRootLogin:

手册页指出PermitRootLogin

  • Specifies whether root can log in using ssh(1).

    指定root是否可以使用ssh(1)登录。

However, it is not clear if this check is based on the user name (root) or the UID (0). What happens if the root account is renamed to admin? Will admin be able to log in when PermitRootLogin=no? What happens if there are two accounts with UID=0 (i.e. root and admin)? Will either of them be able to log in?

但是,尚不清楚此检查是基于用户名( root )还是UID( 0 )。 如果将根帐户重命名为admin会怎样? 当PermitRootLogin = no时, 管理员能够登录吗? 如果有两个UID = 0的帐户(即rootadmin ),会发生什么情况? 他们两个都可以登录吗?

Is PermitRootLogin based on the UID or the user name?

PermitRootLogin是基于UID还是用户名?

答案 (The Answer)

SuperUser contributor mtak has the answer for us:

超级用户贡献者mtak为我们提供了答案:

It seems the check is done with the UID (tested on OpenSSH_6.7p1 Debian-5+deb8u3, OpenSSL 1.0.1t  3 May 2016):

似乎检查是通过UID完成的(已在OpenSSH_6.7p1 Debian-5 + deb8u3,OpenSSL 1.0.1t(2016年5月3日进行了测试 )):

Set PermitRootLogin to Off:

PermitRootLogin设置为Off:

is-permitrootlogin-based-on-the-uid-or-the-user-name-01

Make sure a user named admin is created with UID 0:

确保使用UID 0创建名为admin的用户:

is-permitrootlogin-based-on-the-uid-or-the-user-name-02

Make sure the user can be used to log in to the system:

确保可以使用该用户登录系统:

is-permitrootlogin-based-on-the-uid-or-the-user-name-03

Check to see if we can log in to the system using SSH:

检查我们是否可以使用SSH登录到系统:

is-permitrootlogin-based-on-the-uid-or-the-user-name-04

If we set PermitRootLogin back to On:

如果我们将PermitRootLogin设置回On:

is-permitrootlogin-based-on-the-uid-or-the-user-name-05

And try to log in:

并尝试登录:

is-permitrootlogin-based-on-the-uid-or-the-user-name-06


Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.

有什么补充说明吗? 在评论中听起来不错。 是否想从其他精通Stack Exchange的用户那里获得更多答案? 在此处查看完整的讨论线程

Image Credit: Linux Screenshots/Xmodulo (Flickr/Xmodulo)

图片来源:Linux屏幕截图/ Xmodulo( Flickr / Xmodulo )

翻译自: https://www.howtogeek.com/271272/is-permitrootlogin-based-on-the-uid-or-the-user-name/

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/144059.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • java se与java 的区别_java se与java的区别是什么

    java se与java 的区别_java se与java的区别是什么Java是一门程序设计语言,它有三个版本,JavaSE(标准版)、JavaEE(企业版)和JavaME(微型版)。而JavaSE只是一个使用Java进行编程的规范、框架,它不是一门编程语言。JavaSE(javastandardedition),一般包括jdk、jre以及各种API文档等。JavaSE(JavaPlatform,StandardEdition)。JavaSE以…

    2022年7月9日
    25
  • vagrant共享目录出现“mount:unknown filesystem type ‘vboxsf‘”错误解决方法(亲测可行)

    vagrant共享目录出现“mount:unknown filesystem type ‘vboxsf‘”错误解决方法(亲测可行)

    2022年2月19日
    51
  • h3c bios密码_日本服务器ip端口密码

    h3c bios密码_日本服务器ip端口密码版本Ladon>=7.1139端口NetBIOSFileandPrintSharing通过这个端口进入的连接试图获得NetBIOS/SMB服务。这个协议被用于Windows”文件和打印机共享”和SAMBA。IPC$通信Windows系统中的netuseipc整个通信过程,先445−>137−>139验证,当你开启防火墙禁用445,发现系统命令就无法连接IPC了,根本没机会走到139,所以使用系统自带命令连接的ipc整个通信过程,先445->137->

    2022年10月9日
    2
  • mbus总线电路_CPU电路

    mbus总线电路_CPU电路发送也就是24V,36V切换,24V低电平,36V是高电平;主机接收电路可以高端放大也可以低端放大,设备端只会消耗固定的电流,mbus网络趋于稳定,负载时稳定的,当设备端发送数据时,mbus网络中电流会有所变化,通过采样电阻,电压跟随器,差分放大,采样保持电路,获取ttl电平,短路过载保护也是通过低端采样电阻控制供电开关的。…

    2022年10月15日
    1
  • pycharm2021.9 激活码(JetBrains全家桶)[通俗易懂]

    (pycharm2021.9 激活码)JetBrains旗下有多款编译器工具(如:IntelliJ、WebStorm、PyCharm等)在各编程领域几乎都占据了垄断地位。建立在开源IntelliJ平台之上,过去15年以来,JetBrains一直在不断发展和完善这个平台。这个平台可以针对您的开发工作流进行微调并且能够提供…

    2022年3月26日
    54
  • 我的Python爬虫代码示例(一)

    我的Python爬虫代码示例(一)从链家网站爬虫石家庄符合条件的房源信息,并保存到文件,房源信息包括名称、建筑面积、总价、所在区域、套内面积等。其中所在区域、套内面积需要在详情页获取计算。主要使用了requests+BeautifulSoup第三方模块,具体使用方法可百度。第一版是2019年4月份写的,当前已失效。第二版是12月份写的。第一版:#!/usr/bin/pythonfrombs4impor…

    2022年6月7日
    37

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号