zoukankan      html  css  js  c++  java
  • Ubuntu 20.04 Server Enable root User Account

    初始设置:启用root用户帐户

    The root Account in Ubuntu is disabled by default because his password is not set. To use root priviledges, basically it's better to use the sudo command with administrative accounts. But if you'd like to use root Account itself by some reason, it's possible to use like follows.

    默认情况下,Ubuntu中的root账户是禁用的,因为未设置其密码。要想使用root特权,最好是将sudo命令与管理账户一起使用。但是,如果出于某种原因想要使用root帐户本身,则可以像下面这样使用

    The user account added during installation is set an administrative account with sudo, so it's easy to get root account's shell like follows.

    ubuntu@dlp:~$ sudo -s
    [sudo] password for ubuntu:   # input self password
    root@dlp:/home/ubuntu#        # just switched
    

    Or it's possible to switch to root account with standard su command to set root account's password.

    或者可以使用标准su命令切换到root帐户来设置root帐户的密码

    ubuntu@dlp:~$ sudo passwd root
    [sudo] password for ubuntu:   # input self password
    New password:                 # set root password
    Retype new password:          # confirm
    passwd: password updated successfully
    
    ubuntu@dlp:~$ su -
    Password:                     # input root password
    root@dlp:~#                   # just switched
    

    The examples on this site shows by root user account. If you use sudo, add [sudo] on the head of commands.

    It's better to restrict users who can [su] to root if you enable root account like follows. For using by sudo, it's possible to limit to prohibit shells in sudoers config, refer to details about sudo Settings.

    For [su] command restriction, set like follows.

    root@dlp:~# vi /etc/pam.d/su
    # line 15: uncomment and add a group which is allow to run [su] command
    auth       required   pam_wheel.so  group=adm
    
    # add a user you allowed to run [su] to the group you set above
    # 将您允许运行[su]的用户添加到上面设置的组中
    root@dlp:~# usermod -G adm ubuntu
    
  • 相关阅读:
    dos cmd重启2003命令shutdown -r -t 0
    asp的RegExp对象正则表达式功能用法
    sql查询百分号的方法
    tabbar颜色与文字大小,状态栏样式
    打印所有系统字体名字,创建可拉伸图片,获取文字长度
    判断推送权限是否开启
    mac xcode 快捷键
    一个view相对于屏幕或者另外一个view 的坐标
    swift 2 选择头像图片
    scrapyd在window上的部署
  • 原文地址:https://www.cnblogs.com/PrimerPlus/p/13285803.html
Copyright © 2011-2022 走看看