国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Linux > 正文

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

2020-10-28 18:51:53
字體:
來源:轉載
供稿:網友
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 不加任何參數及用戶名的情況下,默認為更改當前操作用戶的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 ~]# 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 注:看來已經改過來了;
chsh 還是有用的,特加是不允許用戶登錄時,我們可以把用戶的SHELL改到 /sbin/nologin;系統中一些虛擬用戶大多是不能登錄系統的,這對于系統安全來說是極為重要;通過下面的命令查看一下系統中哪些用戶是沒有登錄權限的?
[root@localhost ~]# more /etc/passwd |grep nologin
12下一頁閱讀全文
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 波密县| 奇台县| 苍南县| 胶南市| 建水县| 通渭县| 美姑县| 北宁市| 苍梧县| 西贡区| 韶山市| 云阳县| 佛教| 龙江县| 呼和浩特市| 上林县| 吐鲁番市| 定兴县| 枣庄市| 岫岩| 荥经县| 阿拉善盟| 江城| 沙洋县| 吕梁市| 锡林浩特市| 区。| 鹰潭市| 汪清县| 大连市| 商都县| 仁化县| 大洼县| 雷波县| 同江市| 云林县| 房产| 浮梁县| 弥勒县| 洛隆县| 依兰县|