linux 修改用户的工具

1、chfn修改用户信息工具;
chfn这个工具主要是用来改用户的全名,办公室地址,电话之类的;用法如下:
chfn[-ffull-name][-ooffice][-poffice-phone][-hhome-phone][-u][-v][username]
最简单的方法是
chfn用户名
[root@localhost~]#chfnbeinanlinux注:更改用户beinanlinux的信息;
Changingfingerinformationforbeinanlinux.
Name[]:BeiNan.Linux注:用户全名BeiNan.Linux,随便写一个就行;
Office[]:ChinaDL
OfficePhone[]:66666666
HomePhone[]:99999999
Fingerinformationchanged.注:更改完成;
我们怎么能知道更改好了呢??可以通过finger或直接查看/etc/passwd文件;
[root@localhost~]#fingerbeinanlinux
Login:beinanlinuxName:BeiNan.Linux
Directory:/home/beinanlinuxShell:/bin/bash
Office:ChinaDLHomePhone:99999999
LastloginSatNov511:27(CST)ontty2
Nomail.
NoPlan.
chfn究竟改了/etc/passwd文件中beinanlinux用户的哪部份呢??
[root@localhost~]#more/etc/passwd|grepbeinanlinux
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[-sshell][--list-shells][--help][--version][username]
如果chsh不加任何参数及用户名的情况下,默认为更改当前操作用户的SHELL类型;
举例说明:
[root@localhost~]#chsh--list-shells注:列出当前系统中所有的SHELL;
/bin/sh
/bin/bash
/sbin/nologin注:这个是不允许用户登录系统所用,是极为有用的;您可以通过查看/etc/passwd中看哪些用户是nologin;
/bin/ksh
/bin/tcsh
/bin/csh
/bin/zsh
[root@localhost~]#fingerbeinanlinux|grepShell注:查看用户beinanlinux所用的SHELL类型;
Directory:/home/beinanlinuxShell:/bin/bash注:beinanlinux用的是bash;
[root@localhost~]#chsh-s/bin/kshbeinanlinux注:更改beinanlinux所用的shell为ksh;
Changingshellforbeinanlinux.
Shellchanged.注:更改完成;
[root@localhost~]#fingerbeinanlinux|grepShell注:再次查询beinanlinux所用的SHELL;
Directory:/home/beinanlinuxShell:/bin/ksh注:看来已经改过来了;
chsh还是有用的,特加是不允许用户登录时,我们可以把用户的SHELL改到/sbin/nologin;系统中一些虚拟用户大多是不能登录系统的,这对于系统安全来说是极为重要;通过下面的命令查看一下系统中哪些用户是没有登录权限的?
[root@localhost~]#more/etc/passwd|grepnologin
12下一页阅读全文

tar命令 [root@linux~]#tar[-cxtzjvfpPN]文件与目录…. 参数: -c:建立一个压缩文件的参数指令(create的意思); -x:解开一个压缩文件的参数指令! -t:查看tar ...