手动添加用户步骤


摘录自鸟哥的文档,可以尝试一下不使用useradd的方式添加一个用户:

    如下:

    先建立所需要的群组(vi /etc/group)

    建立账号的各个属性(vi /etc/passwd)

    将passwd与shadow同步化(pwconv)

    建立该账号的密码(passwd acount)

    建立使用者家目录(cp -r /etc/skel /home/account)

    6. 更改家目录属性 ( chown -R account.group /home/account )

    建立新的群组 test ,设其 GID 为 520

    [root @test /root ]# vi /etc/group

  ----略

    test:x:520:test               <==新增群组,且群组的人为 test ,GID 为 520

    建立test的各个属性

    [root @test /root ]# vi /etc/passwd

  ----略

    test:x:520:520:testing account:/home/test:/bin/bash <==建立各个属性

    同步化/etc/passwd与/etc/shadow

    建立新的群组 test ,设其 GID 为 520

    [root @test /root ]# vi /etc/group

  ----略

    test:x:520:test               <==新增群组,且群组的人为 test ,GID 为 520

    建立test的各个属性

    [root @test /root ]# vi /etc/passwd

  ----略

    test:x:520:520:testing account:/home/test:/bin/bash <==建立各个属性

    同步化/etc/passwd与/etc/shadow

    [root @test /root ]# pwconv         <==将 passwd 的资料转入 /etc/shadow 中!

    建立密码

    [root @test /root ]# passwd test <==建立使用者test密码

    Changing password for user test

    New password:

    Retype new password:

    passwd: all authentication tokens updated successfully

    建立家目录并转化家目录的拥有者

    [root @test /root ]# cp -r /etc/skel /home/test

    [root @test /root ]# chown -R test:test /home/test

    OK


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3