歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux服務器 >> 手動添加用戶步驟

手動添加用戶步驟

日期:2017/3/2 16:40:02   编辑:Linux服務器

摘錄自鳥哥的文檔,可以嘗試一下不使用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 © Linux教程網 All Rights Reserved