• CentOS7系列--1.3CentOS7用户管理


    CentOS7用户管理

    1. 添加用户

    [root@centos7 ~]# useradd jack

    [root@centos7 ~]# passwd jack

    Changing password for user jack.

    New password:

    BAD PASSWORD: The password is shorter than 8 characters

    Retype new password:

    passwd: all authentication tokens updated successfully.

    [root@centos7 ~]# exit

    2. 切换用户

    以新添加的用户登录,然后切换到root账号

    login as: jack

    jack@192.168.1.101's password:

    [jack@centos7 ~]$ su -

    Password:

    Last login: Fri Oct 27 06:14:50 CST 2017 from 192.168.1.100 on pts/0

    [root@centos7 ~]#

    3. 将用户作为仅有的可切换到Root的账号

    [root@centos7 ~]# usermod -G wheel jack

    [root@centos7 ~]# vi /etc/pam.d/su

    #%PAM-1.0

    auth sufficient pam_rootok.so

    # Uncomment the following line to implicitly trust users in the "wheel" group.

    #auth sufficient pam_wheel.so trust use_uid

    # Uncomment the following line to require a user to be in the "wheel" group.

    auth required pam_wheel.so use_uid

    auth substack system-auth

    auth include postlogin

    account sufficient pam_succeed_if.so uid = 0 use_uid quiet

    account include system-auth

    password include system-auth

    session include system-auth

    session include postlogin

    session optional pam_xauth.so

    4. 将发向 root的邮件转到新创建的用户

    [root@centos7 ~]# vi /etc/aliases

    gdm: root

    mailnull: root

    postgres: root

    sshd: root

    smmsp: root

    postfix: root

    netdump: root

    ldap: root

    squid: root

    ntp: root

    mysql: root

    desktop: root

    rpcuser: root

    rpc: root

    nfsnobody: root

    ingres: root

    system: root

    toor: root

    manager: root

    dumper: root

    abuse: root

    newsadm: news

    newsadmin: news

    usenet: news

    ftpadm: ftp

    ftpadmin: ftp

    ftp-adm: ftp

    ftp-admin: ftp

    www: webmaster

    webmaster: root

    noc: root

    security: root

    hostmaster: root

    info: postmaster

    marketing: postmaster

    sales: postmaster

    support: postmaster

    # trap decode to catch security attacks

    decode: root

    # Person who should get root's mail

    #root: marc

    root: jack

  • 相关阅读:
    项目常见异常
    mysql 存储过程中使用事物+事件定时执行存储过程
    Spring Mvc 配置 之 ContextLoaderListener
    Spring Boot 之 https
    Spring Boot 之 annotation注解
    用python打印99乘法口诀表
    gerrit代码审核工具之“error unpack failed error Missing unknown”错误解决思路
    在eclipse搭建python开发环境
    python2与python3语法区别之_重定向
    2_jenkins_git创建创建及项目构建
  • 原文地址:https://www.cnblogs.com/gispathfinder/p/8833046.html
Copyright © 2020-2023  润新知