gpt4 book ai didi

bash - .login 未在 CentOS 登录时调用

转载 作者:行者123 更新时间:2023-12-04 19:34:36 25 4
gpt4 key购买 nike

当我阅读 bash shell 时,每次 myUser 登录时都应该调用/home/myUser/.login 。
那就是我要设置和导出一些变量的地方:

在/home/myUser/.login 中:

.  /etc/login
... and some user specific variables later.
echo .login done.

在/etc/login 中一些常见的变量设置,例如:
export JBOSS_HOME=/home/ec2-user/sw/wildfly-8.2.0.Final
echo /etc/login done.

两个回波都不显示。

.  /home/myUser/.login  

作品。

drwx--x--x 6 myUser myUser 4096 Jan 15 18:42 myUser

因为在 useradd -m ... -m 被忽略,
并且 useradd -p hallo ... 不会散列密码(但 passwd --stdin 会),
我想知道我是不是做错的人...

最佳答案

欢迎来到!

bash shell 在交互式登录 session 期间从多个文件中读取。 .login不是其中之一。

来自 bash 手册页的 INVOCATION 部分

When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The
--noprofile option may be used when the shell is started to inhibit this behavior.



希望这能回答你的问题。

关于bash - .login 未在 CentOS 登录时调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27970849/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com