Difference between login shell and non-login shell
Understanding the distinction between your shell types, profile files and shell rc files is important because when you apply modifications to your system you need to know where to set variables in order to make sure that they can be initialized as expected.
Let's give a quick answer for this topic which covers the exact difference between the two shells.
When you login your system and see the command line prompt, it's a login shell, and it executes these files in order:
- /etc/profile
- ~/.bash_profile
- ~/.bashrc
- /etc/bashrc
A non-login shell will only execute the two files in order:
So what's a non-login shell? When issuing this command:
$ ssh joseph@howto.admon.org 'uptime'
you will gain a non-login shell at the remote side howto.admon.org. when you type bash after login, your new shell is also a non-login shell.
Now, you may have a clear answer to a common system administration question: How can I properly apply a new system variable like JAVA_HOME?
It's better to set it in /etc/bashrc other than /etc/profile. Addtionally, there're better choice. If you prefer to make your system clean and tidy, it's suggested to create single config files in /etc/profile.d, the point is all these file would be initialized by both login shell and non-login shell:
$ grep profile /etc/profile /etc/bashrc /etc/profile:# /etc/profile /etc/profile:for i in /etc/profile.d/*.sh ; do /etc/bashrc:# Environment stuff goes in /etc/profile /etc/bashrc: for i in /etc/profile.d/*.sh; do
NOTE: The suffix of the file name should be ".sh", e.g. /etc/profile.d/java.sh
|
分享到:
相关推荐
嵌入式Linux SSH服务搭建 编译好的ssh 目录/Source/openssh-4.6p1为编译后的文件 版本:openssh-4.6p1、openssl-0.9.8f、zlib-1.2.3
linux ssh 使用视频教程, 视频讲解ssh的使用
3.1 linux ssh的安装 首先检查Linux是否安装ssh Rpm –p sshd 如果安装好了将显示 SSH的版本信息,否则请下载安装包进行安装。 下载:openssh-1.2.3.tar.gz。 1)编译OpenSSH需要zlib-devel软件包,这个软件包包括...
linux ssh windows 连接LINUX windows 连接LINUX
arm-linux ssh安装包 交叉编译arm-none-linux-gnueabi-gcc版本gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-29) glibc 2.12.2
linux ssh tftp ftp等配置详解
Linux SSH 使用 SSH 公钥密钥自动登录 Linux 服务器 本文档将介绍如何使用 SSH 公钥密钥自动登录 Linux 服务器,解决频繁输入用户名和密码的问题。下面是相关的知识点: 1. SSH 公钥密钥生成:使用 `ssh-keygen` ...
配置linux ssh免密码登录,第一行生成密钥,第二行是要对哪台机器免密码ssh登录就配置成哪一台,这里root@hadoop00,root是用户名,hadoop00是主机名
加固Linux SSH保证服务器安全.pdf
Linux SSH 配置和禁止 Root 远程登陆设置 ...本文档详细介绍了 Linux SSH 配置和禁止 Root 远程登陆设置的步骤和方法,通过修改 SSH 服务器的配置文件和生成公钥与私钥,可以实现 SSH 服务器的安全配置。
LINUX SSH显示中文乱码解决方法,我们经常都会遇到这样的问题,远程SSH登录LINUX系统时中文字体显示乱码,这里教你怎么解决这个问题。
linux ssh putty.zip
Linux SSH命令大全 学习嵌入式的基本知识 挺全面的资料
linux ssh 客户端 服务端 window服务端linux服务端 安装配置等 搜集整理较全
SSH 工具包括: pscp.exe、psftp.exe、ssh.exe
LinuxSSH使用ssh公钥密钥自动登陆linux服务器收集.pdf
linux SSH 基本命令操作外加vi命令操作大全
Linuxssh登录远程服务器 expect
ssh-key-gen 在本地主机上创建公钥和密钥,用 ssh-copy-id 把公钥复制到远程主机上,直接登录远程主机