zoukankan      html  css  js  c++  java
  • ubuntu创建sudo 用户

    The sudo command provides a mechanism for granting administrator privileges, ordinarily only available to the root user, to normal users. This guide will show you the easiest way to create a new user with sudo access on Ubuntu, without having to modify your server's sudoers file. If you want to configure sudo for an existing user, simply skip to step 3.

     

    Steps to Create a New Sudo User

    1. Log in to your server as the root user.

      • ssh root@server_ip_address
    2. Use the adduser command to add a new user to your system.

      Be sure to replace username with the user that you want to create.

      • adduser username
      • Set and confirm the new user's password at the prompt. A strong password is highly recommended!

        Set password prompts:
        Enter new UNIX password:
        Retype new UNIX password:
        passwd: password updated successfully
        
      • Follow the prompts to set the new user's information. It is fine to accept the defaults to leave all of this information blank.

        User information prompts:
        Changing the user information for username
        Enter the new value, or press ENTER for the default
            Full Name []:
            Room Number []:
            Work Phone []:
            Home Phone []:
            Other []:
        Is the information correct? [Y/n]
        
    3. Use the usermod command to add the user to the sudo group.

      • usermod -aG sudo username

      By default, on Ubuntu, members of the sudo group have sudo privileges.

    4. Test sudo access on new user account

      • Use the su command to switch to the new user account.

        • su - username
      • As the new user, verify that you can use sudo by prepending "sudo" to the command that you want to run with superuser privileges.

        • sudo command_to_run
      • For example, you can list the contents of the /root directory, which is normally only accessible to the root user.

        • sudo ls -la /root
      • The first time you use sudo in a session, you will be prompted for the password of the user account. Enter the password to proceed.

        Output:
        [sudo] password for username:
        

        If your user is in the proper group and you entered the password correctly, the command that you issued with sudo should run with root privileges.

  • 相关阅读:
    iOS:真机调试
    iOS:MBProgressHUD的基本使用
    CocoaPods安装小步骤
    PictureBox 双缓冲防止闪屏
    两招小办法对付宝宝发烧、咳嗽。超级管用哈
    (转)经纬度坐标转换为屏幕坐标
    解决eclipse不识别Android手机的问题
    利用FFmpeg将RTSP转码成RTMP发布在RED5
    vlc做转发的命令
    字符编码
  • 原文地址:https://www.cnblogs.com/oxspirt/p/9519246.html
Copyright © 2011-2022 走看看