linux系统/etc/shells文件用途

linux系统/etc/shells文件用途

编程入门hacker2015-11-18 5:16:1910202A+A-

/etc/shells文档主要用途

始终对/etc/shells这一文档的功效并不是太清晰,近期挤时间查了查,小结给出。

$ man shells

SHELLS(5) Linux Programmer’s Manual SHELLS(5)

NAME

shells - pathnames of valid login shells

DESCRIPTION

/etc/shells is a text file which contains the full pathnames of valid login shells.

This file is consulted by chsh(1) and available to be queried by other programs.

Be aware that there are programs which consult this file to find out if a user is a

normal user. E.g.: ftp daemons traditionally disallow access to users with shells

not included in this file.

EXAMPLE

/etc/shells may contain the following paths:

/bin/sh

/bin/csh

FILES

/etc/shells

SEE ALSO

chsh(1), getusershell(3)

1993-11-21 SHELLS(5)

/etc/shells是1个合理登录shell的目录,在启用chsh更改登录shell时,会查寻这一文档。

[root@winway ~]# cat /etc/shells

/bin/sh

/bin/bash

/sbin/nologin

/bin/tcsh

/bin/csh

/bin/ksh

 linux系统/etc/shells文件用途 第1张

[winway@winway ~]$ chsh

Changing shell for winway.

动态口令:

New shell [/bin/bash]: /bin/date

chsh: "/bin/date" is not listed in /etc/shells.

chsh: use -l option to see list

       因为/bin/date/没有/etc/shells里,因此用户启用chsh不成功。root启用会出現warning。

 

[root@winway ~]# echo '/bin/date' >>/etc/shells

 

[winway@winway ~]$ chsh -l

/bin/sh

/bin/bash

/sbin/nologin

/bin/tcsh

/bin/csh

/bin/ksh

/bin/date

[winway@winway ~]$ chsh

Changing shell for winway.

动态口令:

New shell [/bin/bash]: /bin/date

Shell changed.

[winway@winway ~]$ grep 'winway' /etc/passwd

winway:x:500:500:ww,isrc,no,no:/home/winway:/bin/date

另一个某些程序流程会依据这一文档来分辨1个客户是不是合理客户,比如FTP服务项目会机构这些shell没有/etc/shells里的客户登录。


点击这里复制本文地址 以上内容由黑资讯整理呈现,请务必在转载分享时注明本文地址!如对内容有疑问,请联系我们,谢谢!
  • 2条评论
  • 鸠骨痛言2022-05-28 04:01:03
  • g shell for winway.动态口令:New shell [/bin/bash]: /bin/datechsh: "/bin/date" is not listed in /etc/shells.chsh:
  • 掩吻一镜2022-05-27 18:59:20
  • mes of valid login shellsDESCRIPTION/etc/shells is a text file which contains the full pathnames of valid login shells.This file is con

支持Ctrl+Enter提交

黑资讯 © All Rights Reserved.  
Copyright Copyright 2015-2020 黑资讯
滇ICP备19002590号-1
Powered by 黑客资讯 Themes by 如有不合适之处联系我们
网站地图| 发展历程| 留言建议| 网站管理