`
kiikoo
  • 浏览: 7863 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

linux ssh

阅读更多

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:

  • /etc/bashrc
  • ~/.bashrc

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

    嵌入式Linux SSH服务搭建是将Secure Shell (SSH) 服务应用于资源有限的嵌入式设备上,以实现远程安全登录、文件传输等功能。SSH是一种网络协议,它提供了加密网络服务,确保在不安全的网络环境中传输数据的安全性。...

    arm-linux ssh安装包

    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 ssh

    Linux SSH (Secure Shell) 是一个网络协议,用于在不安全的网络上安全地远程登录Linux系统,执行命令和传输数据。SSH提供了加密的网络通信,确保了数据在传输过程中的安全性,防止被窃听或篡改。在Windows系统中,...

    linux ssh 使用视频教程

    linux ssh 使用视频教程, 视频讲解ssh的使用

    linux ssh key

    Linux SSH Key 生成和使用 Linux SSH key 是一种常用的身份验证方式,通过生成公钥和私钥来实现无密码登录远程 Linux 主机。本文将详细介绍如何在 Linux 和 Windows 平台上生成和使用 SSH key。 一、Linux 平台上...

    linux ssh的配置

    ### Linux SSH 的配置详解 #### 3.1 Linux SSH 的安装与配置 ##### 安装 SSH 服务 在 Linux 系统中安装 SSH 服务前,我们首先要确认系统是否已经安装了 SSH。可以通过以下命令检查 SSH 服务是否已安装: ```bash...

    java linux ssh登陆

    标题“Java Linux SSH登录”指的是使用Java编程语言与Linux操作系统进行安全外壳(SSH)通信的过程。在描述中提到,这个过程通常涉及建立一个通道并执行单个命令。这里,我们将会详细探讨Java如何通过SSH连接到Linux...

    Linux_SSH配置和禁止Root远程登陆设置文档

    ### Linux SSH配置与安全增强详解 #### 一、概述 SSH(Secure Shell)是一种网络协议,用于计算机之间的加密登录和命令执行,以及数据传输。它能够有效防止远程管理过程中的信息泄露、身份替换等攻击。在Linux系统...

    linux ssh 客户端 服务端 window服务端linux服务端 安装配置等 搜集整理较全

    本文将详细介绍Linux SSH客户端和服务端的安装、配置以及Windows作为服务端与Linux之间的SSH连接。 ### 一、Linux SSH服务端安装 在大多数Linux发行版中,SSH服务通常预装。如果没有,可以通过包管理器安装: - *...

    linux ssh putty.zip

    Linux SSH Putty.zip 文件是一个与远程访问Linux服务器相关的压缩包,它包含了一个流行的终端模拟器Putty,用于连接到Linux系统使用SSH(Secure Shell)协议。SSH是一种网络协议,允许用户安全地通过不安全的网络...

    LINUX SSH显示中文乱码解决

    ### Linux SSH 显示中文乱码解决方案 在日常工作中,我们经常需要通过SSH远程登录到Linux系统来进行各种管理和操作。然而,一个常见的问题是当我们在Windows环境下使用SSH客户端(如PuTTY等)连接到Linux服务器时,...

    LinuxSSH使用ssh公钥密钥自动登陆linux服务器.pdf

    Linux SSH 使用 SSH 公钥密钥自动登录 Linux 服务器 本文档将介绍如何使用 SSH 公钥密钥自动登录 Linux 服务器,解决频繁输入用户名和密码的问题。下面是相关的知识点: 1. SSH 公钥密钥生成:使用 `ssh-keygen` ...

    linux SSH 基本命令操作。

    在Linux系统中,SSH(Secure Shell)是一种网络协议,用于安全地远程登录到服务器,进行命令行操作。SSH提供加密的网络通信,确保了数据传输的安全性。掌握基本的SSH命令是任何Linux管理员或开发者的必备技能。接...

    Linux SSH配置和禁止Root远程登陆设置文档(技术学习).docx

    Linux SSH 配置和禁止 Root 远程登录设置 Linux SSH 配置和禁止 Root 远程登录设置是 Linux 系统中的一项重要的安全设置。通过本文档,我们将了解如何配置 SSH 服务器,禁止 Root 用户远程登录,提高 Linux 系统的...

    linuxssh安全的加固方法.pdf

    Linux SSH 安全加固方法 Linux SSH 安全加固方法是为了增强服务器的安全性,防止未经授权的访问和攻击。下面将详细介绍 Linux SSH 安全加固方法的相关知识点。 一、禁用 ROOT 远程 SSH 登录 在 Linux 系统中,...

    配置linux ssh免密码登录

    配置linux ssh免密码登录,第一行生成密钥,第二行是要对哪台机器免密码ssh登录就配置成哪一台,这里root@hadoop00,root是用户名,hadoop00是主机名

    linux ssh远程服务器自动输入密码 sshpass插件

    Linux SSH(Secure Shell)是一种广泛使用的网络协议,用于在不安全的网络环境中提供加密的远程登录和其他网络服务。SSHpass是一个方便的Linux工具,专为自动化任务设计,它允许通过命令行接口在SSH连接中自动输入...

    Linuxssh登录远程服务器 expect

    标题中的"Linux ssh登录远程服务器 expect"指的就是使用 Expect 脚本来自动化Linux系统中通过SSH协议登录远程服务器的过程。这种方式对于需要频繁进行自动化运维任务的管理员来说非常有用,可以显著提高效率,减少...

    加固Linux SSH保证服务器安全.pdf

    加固Linux SSH保证服务器安全.pdf

    Linux SSH配置和禁止Root远程登陆设置文档之欧阳术创编.docx

    在Linux系统中,SSH是管理员和用户常用的一种远程控制工具。本文将详细介绍如何配置SSH以及如何禁止Root用户通过SSH进行远程登录。 ### 1. SSH配置 #### 1.1 修改`sshd_config`文件 SSH服务的配置主要在`/etc/ssh...

Global site tag (gtag.js) - Google Analytics