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


相关推荐

  • MQTT协议,终于有人讲清楚了[通俗易懂]

    MQTT协议,终于有人讲清楚了[通俗易懂]大家好,我是小麦,最近做了一个物联网的项目,顺便总结一下MQTT协议。大家都知道,MQTT协议在物联网中很常用,如果你对此还不是很了解,相信这篇文章可以带你入门。mqtt协议1MQTT协…

    2022年6月25日
    62
  • samba文件共享服务配置过程_文件服务器硬件要求

    samba文件共享服务配置过程_文件服务器硬件要求一、共享需求:建立公共目录public,开启匿名用户访问权限,所有人均可读写(方便但不安全) 建立public文件,只有@admin组和admin、job用户可以进行读写,其余用户均不可以访问。要求:admin用户不能删除job用户创建的文件,反之亦然。 建立hr共享文件,要求用户名和密码验证访问,只有@hr组和hr1,job的用户可以进行访问。要求:@hr组和hr1具有完全控制的权限,job用户只有读取的权限。 建立eng共享文件,除了@eng组和eng1的用户可以访问,其他人均不可以访问,也

    2022年9月24日
    2
  • mongodb导入json_json格式是什么

    mongodb导入json_json格式是什么刚开始接触mongodb,以下介绍使用mongoVUE来导入和导出json格式的数据1、导出瞬间导出到指定的text文件中,我们用文本编辑器打开预览2、导入导入的时候首先我我们要选择导入的表,点进去之后可以直接写json文本也可以导入,txt文件不过我们刚刚导出的json格式的txt文件是不能直接导入的,稍作一下修改,(需要的话去掉_id),去掉每个json串之间…

    2022年8月21日
    8
  • C语言位运算符_C语言左移和右移的区别

    C语言位运算符_C语言左移和右移的区别如果你想了解以下位运算符的话我想你来对了地方&^|~<<>>首先明确位运算符都是在二进制位上运算的先讲比较简单的<<>>(有些人可能认为这个最难以理解包括我)后来我陡然一时想到了十进制左移“<<”右移“>>”十进制10左移三位就是乘以10的3次方=1000010右…

    2022年10月5日
    2
  • 在eclipse中没有server(需在选项中设置)

    Eclipse中没有Server选项,需要加载插件。步骤如下:①在软件eclipse下的Help-&gt;InstallNewSoftware-&gt;中,在Workwith中点击Add,如下,加入Name:KeplerLocation:http://download.eclipse.org/releases/kepler②找到选项Web,XML,JavaEEan…

    2022年4月10日
    209
  • matlab创建控件失败win7,Win7系统无法安装ActiveX控件的解决方法

    matlab创建控件失败win7,Win7系统无法安装ActiveX控件的解决方法Win7系统无法安装ActiveX控件怎么办?ActiveX控件是网站常用的一款网页辅助工具,有时候我们可能需要安装它,但是却发现浏览器阻止了它安装,那么当你遇到这种情况该怎么办呢?下面小编就给大家带来Win7系统无法安装ActiveX控件的解决方法,一起来看看吧!以下从多种角度出发分析,并非仅仅针对截图所示及以上提示。方法/步骤:1、首先建议将相应网站加入可信站点。2、其次建议选中可信站点。自定…

    2022年5月14日
    53

发表回复

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

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