天天看點

互傳檔案、使用者密碼配置檔案、使用者組、使用者管理

方式:lrzsz 、ftp、

[root@localhost ~]# yum install -y lrzsz

rz 上傳

sz 下載下傳

2.使用者配置檔案和密碼配置檔案

[root@localhost ~]# cat /etc/passwd  //使用者核心配置檔案

使用者 密碼 uid   gid  使用者注釋     家目錄   使用者shell

Lsx  : x:  1000: 1000  :   :   /home/lsx:  /bin/bash  //自己建立的使用者從1000開始

user1:x:1001:1001::/home/user1:/bin/bash

user2:x:1002:1002::/home/user2:/bin/bash

user3:x:1003:1003::/home/user3:/bin/bash

[root@localhost ~]# man shadow  //檢視配置解釋

[root@localhost ~]# cat /etc/shadow  //存密碼檔案

使用者 密碼  天數

user1:  !!:  17459:  0:  99999:  7: : :

第三段天數:最近更改密碼的日期(日期計算方法是從1970年1月1日開始的天數)

第四段表示多少天之後可以更改密碼

第五段多久不能更改

第六段密碼多少天後到期

user2:!!:17459:0:99999:7:::

user3:!!:17460:0:99999:7:::

[root@localhost ~]# passwd lsx  //設定密碼

3.使用者組管理

[root@localhost ~]# cat /etc/group //組檔案

[root@localhost ~]# groupadd -g 996 grp1  //建立指定的gid組

[root@localhost ~]# groupdel grp1 //删除組(前提是組裡沒有人)

4.使用者管理

[root@localhost ~]# userdel user1  //删除使用者

[root@localhost ~]# userdel -r lsx1  //使用者家目錄一起删除

[root@localhost ~]# useradd user4 -M  //增加使用者不添加家目錄

[root@localhost ~]# useradd -u 1006 -g 1003 user10 //添加指定uid使用者到指定的組裡(組必須存在)

[root@localhost ~]# useradd -g user3 user5  //添加使用者到指定的組(寫組名的方式也可)

[root@localhost ~]# id user5

uid=1005(user5) gid=1004(user4) 組=1004(user4)

[root@localhost ~]# useradd -u 1005 -g 1004 -d /home/lsx1 -s /sbin/nologin lsx1 //-d将建立家目錄

[root@localhost ~]# usermod -d /home/user18 user8  //修改家目錄但是/home下面的家目錄名字不會改變

[root@localhost ~]# tail -1 /etc/passwd

user8:x:1009:1009::/home/user18:/bin/bash

[root@localhost ~]# ls /home/

lsx  user1  user2  user5  user6  user7  user8

Uid會自增,不會根據gid自增

本文轉自 蝦米的春天 51CTO部落格,原文連結:http://blog.51cto.com/lsxme/1977289,如需轉載請自行聯系原作者