欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

linux下修改用戶的工具介紹第1/2頁

 更新時間:2007年11月26日 15:00:25   作者:  
1、chfn 修改用戶信息工具;
chfn 這個工具主要是用來改用戶的全名,辦公室地址,電話之類的;用法如下:
chfn [ -f full-name ] [ -o office ] [ -p office-phone ] [ -h home-phone ] [ -u ] [ -v ] [ username ]
最簡單的方法是
chfn 用戶名
[root@localhost ~]# chfn beinanlinux 注:更改用戶beinanlinux的信息;
Changing finger information for beinanlinux.
Name []: BeiNan.Linux 注:用戶全名BeiNan.Linux ,隨便寫一個就行;
Office []: ChinaDL
Office Phone []: 66666666
Home Phone []: 99999999
Finger information changed. 注:更改完成;
我們怎么能知道更改好了呢??可以通過finger 或直接查看/etc/passwd文件;
[root@localhost ~]# finger beinanlinux
Login: beinanlinux Name: BeiNan.Linux
Directory: /home/beinanlinux Shell: /bin/bash
Office: ChinaDL Home Phone: 99999999
Last login Sat Nov 5 11:27 (CST) on tty2
No mail.
No Plan.
chfn 究竟改了/etc/passwd 文件中beinanlinux用戶的哪部份呢??
[root@localhost ~]# more /etc/passwd |grep beinanlinux
beinanlinux:x:509:509:BeiNan.Linux,ChinaDL,66666666,99999999:/home/beinanlinux:/bin/bash
通過more /etc/passwd ,然后來抽取 beinanlinux記錄,看一下紅字標出的,就是我們通過chfn 修改過的地方,所以我們可以直接通過修改/etc/passwd文件來達到目的;

2、chsh 改變用戶的SHELL類型;

[root@localhost ~]# chsh --help
Usage: chsh [ -s shell ] [ --list-shells ] [ --help ] [ --version ] [ username ]
如果chsh 不加任何參數(shù)及用戶名的情況下,默認為更改當前操作用戶的SHELL類型;
舉例說明:
[root@localhost ~]# chsh --list-shells 注:列出當前系統(tǒng)中所有的SHELL;
/bin/sh
/bin/bash
/sbin/nologin 注:這個是不允許用戶登錄系統(tǒng)所用,是極為有用的;您可以通過查看/etc/passwd 中看哪些用戶是nologin;
/bin/ksh
/bin/tcsh
/bin/csh
/bin/zsh
[root@localhost ~]# finger beinanlinux |grep Shell 注:查看用戶beinanlinux 所用的SHELL類型;
Directory: /home/beinanlinux Shell: /bin/bash 注:beinanlinux用的是bash ;
[root@localhost ~]# chsh -s /bin/ksh beinanlinux 注:更改beinanlinux所用的shell 為ksh ;
Changing shell for beinanlinux.
Shell changed. 注:更改完成;
[root@localhost ~]# finger beinanlinux |grep Shell 注:再次查詢beinanlinux所用的SHELL;
Directory: /home/beinanlinux Shell: /bin/ksh 注:看來已經(jīng)改過來了;
chsh 還是有用的,特加是不允許用戶登錄時,我們可以把用戶的SHELL改到 /sbin/nologin;系統(tǒng)中一些虛擬用戶大多是不能登錄系統(tǒng)的,這對于系統(tǒng)安全來說是極為重要;通過下面的命令查看一下系統(tǒng)中哪些用戶是沒有登錄權(quán)限的?
[root@localhost ~]# more /etc/passwd |grep nologin

相關(guān)文章

最新評論