zoukankan      html  css  js  c++  java
  • centos:添加用户

    初步进入centos学习,配置用户

    1,创建用户

    创建用户 hadoop

    [root@master spark]# useradd hadoop
    [root@master spark]#

    2,创建密码

    [root@master spark]# passwd hadoop
    Changing password for user hadoop.
    New password: 
    BAD PASSWORD: The password is shorter than 8 characters
    Retype new password: 
    passwd: all authentication tokens updated successfully.

    3,用户授权

    创建账户必须授权,不然,个人用户的权限只可以在本home下有权限,其他的必须有授权,一般需要root的权限
    sudo的命令授权一般在sudoers里面
    找到sudoer文件位置
    看下文件的权限

    [spark@master ~]$ sudoers
    -bash: sudoers: command not found
    [spark@master ~]$ whereis sudoers
    sudoers: /etc/sudoers /etc/sudoers.d /usr/share/man/man5/sudoers.5.gz

    只读的文件,可以修改权限或者强行保存

    [root@centos etc]# vi /etc/sudoers
    ## Allow root to run any commands anywher
    root   ALL=(ALL) ALL #这个是新增的用户 
    hadoop ALL=(ALL) ALL  #这个是新增的用户

    用x!命令强制保存

    或者修改文件权限

    chmod -v u+w /etc/sudoers

    配置完了,最好把权限收回

    chmod -v u-w /etc/sudoers

    到这里基本结束了。

    可以用新用户登陆了,使用sudo命令这块

    [hadoop@centos ~]$ sudo cat /etc/passwd
    We trust you have received the usual lecture from the local System
    Administrator. It usually boils down to these three things:
    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.
    
    [sudo] password for hadoop:
  • 相关阅读:
    微信小程序非域名测试环境,手机预览不正常,模拟器和真机调试正常解决办法
    vue 建项目及初步开发遇到的问题
    开发&测试
    架构&项目
    运维
    读书&源码
    ArrayList
    jdk集合知识点整理
    jdk集合关系图
    jvm知识点整理
  • 原文地址:https://www.cnblogs.com/yy3b2007com/p/9325575.html
Copyright © 2011-2022 走看看