概述
参考 : http://blog.csdn.net/lawrencesgj/article/details/8979803
https://wido.me/sunteya/understand-bashrc-and-profile/
login shell 和 no-login shell
“login shell” 代表用户登入, 比如使用 “su -“ 命令, 或者用 ssh 连接到某一个服务器上, 都会使用该用户默认 shell 启动 login shell 模式.
该模式下的 shell 会去自动执行 /etc/profile
和 ~/.profile
文件, 但不会执行任何的 bashrc 文件, 所以一般再 /etc/profile 或者 ~/.profile 里我们会手动去 source bashrc 文件.
而 no-login shell 的情况是我们在终端下直接输入 bash 或者 bash -c “CMD” 来启动的 shell.
该模式下是不会自动去运行任何的 profile 文件.
参考 ~/.profile:
- # ~/.profile: executed by the command interpreter for login shells.
- # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
- # exists.
- # see /usr/share/doc/bash/examples/startup-files for examples.
- # the files are located in the bash-doc package.
- # the default umask is set in /etc/profile; for setting the umask
- # for ssh logins, install and configure the libpam-umask package.
- #umask 022
- # if running bash
- if [ -n "$BASH_VERSION" ]; then
- # include .bashrc if it exists
- if [ -f "$HOME/.bashrc" ]; then
- . "$HOME/.bashrc"
- fi
- fi
- # set PATH so it includes user's private bin if it exists
- if [ -d "$HOME/bin" ] ; then
- PATH="$HOME/bin:$PATH"
- fi
最后
以上就是淡定白羊为你收集整理的使用ssh登入不执行.bashrc解决方法的全部内容,希望文章能够帮你解决使用ssh登入不执行.bashrc解决方法所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复