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爬虫系列三:使用Jsoup解析HTML「建议收藏」

    在上一篇随笔《Java爬虫系列二:使用HttpClient抓取页面HTML》中介绍了怎么使用HttpClient进行爬虫的第一步–抓取页面html,今天接着来看下爬虫的第二步–解析抓取到的html

    2022年2月16日
    36
  • windows Netstat命令详解

    windows Netstat命令详解Netstat用于显示与IP、TCP、UDP和ICMP协议相关的统计数据,一般用于检验本机各端口的网络连接情况。如果你的计算机有时候接收到的数据报导致出错数据或故障,你不必感到奇怪,TCP/IP可以容许这些类型的错误,并能够自动重发数据报。但如果累计的出错情况数目占到所接收的IP数据报相当大的百分比,或者它的数目正迅速增加,那么你就应该使用…

    2022年5月29日
    218
  • Linux rootfs_hdfs shell命令

    Linux rootfs_hdfs shell命令本文阐述Linux中的文件系统部分,源代码来自基于IA32的2.4.20内核。总体上说Linux下的文件系统主要可分为三大块:一是上层的文件系统的系统调用,二是虚拟文件系统VFS(VirtualFilesystemSwitch),三是挂载到VFS中的各实际文件系统,例如ext2,jffs等。本文侧重于通过具体的代码分析来解释Linux内核中VFS的内在机制,在这过程

    2022年9月28日
    4
  • js网页如何获取手机屏幕宽度

    js网页如何获取手机屏幕宽度

    2021年10月31日
    49
  • 二分查找判定树(二分查找树平均查找长度)

    如果data[0]等于一组数据中最小的,那么就会增加查找的时间复杂度。平衡二叉树(追求极致的平衡),现实需求很难满足,红黑数孕育而生

    2022年4月11日
    179
  • 【深度思考】郑州java培训机构排名

    【深度思考】郑州java培训机构排名前言分布式,是程序员必备技能之一,在面试过程中属于必备类的,在工作中更是会经常用到。而Kafka是一个分布式的基于发布订阅的消息队列,目前它的魅力是无穷的,对于Kafka的奥秘,还需要我们细细去探寻。要谈对Kafka有多熟悉,我相信还是阿里的大佬们最有发言权,所以今天分享的内容,就是Alibaba内部供应的“限量笔记”,关于Kafka的精髓全部写在这里面了,不得不感叹:不愧是Alibaba的技术官啊,真的服了!一、背景我们日常在电商网站购物时经常会遇到一些高并发的场景,例如电商App上经常出现的

    2022年10月3日
    2

发表回复

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

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