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的帐户(即root和admin ),会发生什么情况? 他们两个都可以登录吗?

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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 海康sdk协议接口_海康威视开发平台

    海康sdk协议接口_海康威视开发平台本文接上次的博客海康威视工业相机SDK二次开发(VS+Opencv+QT+海康SDK+C++)(一),上个博客中并未用到QT,本文介绍项目内容及源码,供大家参考。由于我的项目中是用海康相机作为拍照的一个中介,重点是在目标识别方向,请阅读源码时自动忽略。如果对目标识别感兴趣,可以参考我的YOLO系列https://blog.csdn.net/qq_45445740/category_9794819.html目录1.说明1.1环境配置1.2背景说明2.源码MvCamera.hmythread.

    2022年10月22日
  • 通达OA工作流-表单设计

    通达OA工作流-表单设计第1章什么是工作流 1.1工作流的用途 随着企业管理信息化进程的不断深入,协同应用软件的概念已深入人心,而工作流系统正是协同应用软件的核心。通过应用IT技术来规范工作流程、提高工作的执行效率和准确度、使企业运营更加高效、规范、稳健,是工作流系统主要解决的问题。OfficeAnywhere内置的工作流系统,适用于各行各业,实现企业各类业务的申请、审批…

    2022年6月23日
  • Tomcat的下载及安装

    Tomcat的下载及安装一、Tomcat下载1、打开Tomcat官网,默认进入官网首页,官网地址为:https://tomcat.apache.org/2、左侧的导航栏可以看到Download(下载),以及最近相关版本的Tomcat(9、8、7…),这里选择的是Tomcat8,点击进入3、进入tomcat8的相关页面后会显示一些该版本的信息,可以忽略,鼠标下滑进行查找4、这里我们可以看到…

    2022年5月19日
  • web基础知识_Web开发基础

    web基础知识_Web开发基础传统身份验证的方法:HTTP是一种没有状态的协议,也就是它并不知道是谁是访问应用。这里我们把用户看成是客户端,客户端使用用户名还有密码通过了身份验证,不过下回这个客户端再发送请求时候,还得再验证一下。解决的方法就是,当用户请求登录的时候,如果没有问题,我们在服务端生成一条记录,这个记录里可以说明一下登录的用户是谁,然后把这条记录的ID号发送给客户端,客户端收到以后把这个ID号存储在C…

    2022年9月13日
  • 2020微信小程序反编译教程(小程序反编译源码能用吗)

    文章主要实现:废话不多说下面就直接来流程了!第1步:先安装node.js点击下载第2步:再下载wxappUnpacker反编译包点击下载包第3步:保证以上都安装后电脑命令窗口:CMD运行第2步目录运行加载node依赖:命令窗口复制以下黄色命令:npminstalluglify-es–savenpminstall…

    2022年4月16日
  • matlab中imfinfo 有关图形文件的信息

    matlab中imfinfo 有关图形文件的信息来源:https://ww2.mathworks.cn/help/matlab/ref/imfinfo.html?searchHighlight=imfinfo&s_tid=doc_srcht

    2022年7月3日

发表回复

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

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