systemd:SULOGIN为什么要大写呢;sulogin-创新互联

文章目录
  • systemd
  • sulogin
    • 选项
    • 环境变量
    • sulogin 编译选项

创新互联坚持“要么做到,要么别承诺”的工作理念,服务领域包括:网站建设、做网站、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的故城网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!systemd

meson.build文件中有这么一段。最后会将progs的第一个元素转换成大写:prog[0].to_upper();这个是将其转换为宏定义。在程序使用时使用比如:static const char* const sulogin_cmdline[] = {SULOGIN, NULL}; ;这个会为代码阅读搜索带来麻烦。

# if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
# /usr/sbin, /sbin, and fall back to the default from middle column.
progs = [['quotaon',    '/usr/sbin/quotaon'    ],
         ['quotacheck', '/usr/sbin/quotacheck' ],
         ['kmod',       '/usr/bin/kmod'        ],
         ['kexec',      '/usr/sbin/kexec'      ],
         ['sulogin',    '/usr/sbin/sulogin'    ],
         ['mount',      '/usr/bin/mount',      'MOUNT_PATH'],
         ['umount',     '/usr/bin/umount',     'UMOUNT_PATH'],
         ['loadkeys',   '/usr/bin/loadkeys',   'KBD_LOADKEYS'],
         ['setfont',    '/usr/bin/setfont',    'KBD_SETFONT'],
        ]
foreach prog : progs
        path = get_option(prog[0] + '-path')
        if path != ''
                message('Using @1@ for @0@'.format(prog[0], path))
        else
                exe = find_program(prog[0],
                                   '/usr/sbin/' + prog[0],
                                   '/sbin/' + prog[0],
                                   required: false)
                path = exe.found() ? exe.path() : prog[1]
        endif
        name = prog.length() >2 ? prog[2] : prog[0].to_upper()
        conf.set_quoted(name, path)
        substs.set(name, path)
endforeach
sulogin

sulogin - single-user login
用法:sulogin [options] [tty]
如果系统进入单用户模式时(比如进入emergency mode),由init、systemd 带起来sulogin。
会提示用户输入密码,进入系统维护窗口(或者键入Ctrl-D,继续正常的启动,就不会进入单用户,紧急模式)。

如果root用户被锁定,并且带有选项:–force,不需要密码就可以之间进入系统。
sulogin will be connected to the current terminal, or to the optional tty device that can be specified on the command line (typically /dev/console).

When the user exits from the single-user shell, or presses control-D at the prompt, the system will continue to boot.

选项

-e, --force If the default method of obtaining the root password from the system via getpwnam(3) fails, then examine /etc/passwd and /etc/shadow to get the password. If these files are damaged or nonexistent, or when root account is locked by ‘!’ or ‘*’ at the begin of the password then sulogin will start a root shell without asking for a password. Only use the -e option if you are sure the console is physically protected against unauthorized access.
-p, --login-shell Specifying this option causes sulogin to start the shell process as a login shell.
-t, --timeout seconds Specify the maximum amount of time to wait for user input. By default, sulogin will wait forever.
-h, --help Display help text and exit.
-V, --version Display version information and exit.

环境变量

使用到的环境变量是:SUSHELL or sushell,指明要启动什么shell。If the environment variable is not set, it will try to execute root’s shell from /etc/passwd. If that fails, it will fall back to /bin/sh.
https://www.kernel.org/pub/linux/utils/util-linux/

sulogin 编译选项

[root@10 ~]# rpm -q --queryformat=“%{NAME}: %{OPTFLAGS}\n” util-linux-2.32.1-35.el8.x86_64
util-linux: -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection

你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧


当前标题:systemd:SULOGIN为什么要大写呢;sulogin-创新互联
标题来源:http://bzwzjz.com/article/ddhcjj.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 上市集团网站建设 重庆网站制作 成都网站设计制作公司 企业网站设计 营销网站建设 成都网站建设 高端网站设计 H5网站制作 成都商城网站建设 成都网站制作 网站设计 手机网站设计 成都商城网站制作 成都网站制作 自适应网站建设 泸州网站建设 梓潼网站设计 成都企业网站建设 成都网站建设公司 成都营销网站建设 网站建设方案 自适应网站设计