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:
  • 相关阅读:
    良好的三元组(求已排列好的数组中各个元素的排位)
    山理工oj 2556传说中的数据结构
    山理oj 1177 时间间隔
    山理oj1525:字符统计2
    linux常用命令
    多线程并发教程
    合理设置线程数量
    Java多线程处理任务(摘抄)
    解决2013Lost connection to MySQL server during query错误方法
    javaMail邮件发送
  • 原文地址:https://www.cnblogs.com/yy3b2007com/p/9325575.html
Copyright © 2011-2022 走看看