都加载了哪些文件,哪些内容?
我自己测试发现根本没有任何动静
注:切换用户不是使用su命令
谢谢
5 个解决方案
#1
/etc/profile
/home/用户名/.bash_profile
/home/用户名/.bashrc
/etc/bashrc
还有/home/用户名/桌面的配置文件
/home/用户名/.bash_profile
/home/用户名/.bashrc
/etc/bashrc
还有/home/用户名/桌面的配置文件
#2
在/etc/bashrc里面有做终端判断的:
# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
# are we an interactive shell?
if [ "$PS1" ]; then
if [ -z "$PROMPT_COMMAND" ]; then
case $TERM in
xterm*)
if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
else
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
fi
;;
screen)
if [ -e /etc/sysconfig/bash-prompt-screen ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
else
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
fi
;;
*)
[ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
;;
esac
fi
# Turn on checkwinsize
shopt -s checkwinsize
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
# You might want to have e.g. tty in prompt (e.g. more virtual machines)
# and console windows
# If you want to do so, just add e.g.
# if [ "$PS1" ]; then
# PS1="[\u@\h:\l \W]\\$ "
# fi
# to your custom modification shell script in /etc/profile.d/ directory
fi
# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
# are we an interactive shell?
if [ "$PS1" ]; then
if [ -z "$PROMPT_COMMAND" ]; then
case $TERM in
xterm*)
if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
else
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
fi
;;
screen)
if [ -e /etc/sysconfig/bash-prompt-screen ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
else
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
fi
;;
*)
[ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
;;
esac
fi
# Turn on checkwinsize
shopt -s checkwinsize
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
# You might want to have e.g. tty in prompt (e.g. more virtual machines)
# and console windows
# If you want to do so, just add e.g.
# if [ "$PS1" ]; then
# PS1="[\u@\h:\l \W]\\$ "
# fi
# to your custom modification shell script in /etc/profile.d/ directory
fi
#3
通过桌面点击后台不是运行哪些基本的配置文件吗?
#4
-------------------------------------
先对两位表示感谢,我的问题是这样的:
我的机子上有两个用户:test1,test2
首先我登录test1,我知道此事会执行/etc/profile(用su切换的时候也会执行)
-->切换用户,切换用户的时候test1打开的内容不会关闭。
-->登录test2,由于是首次登录肯定会执行/etc/profile
-->再切换到test1,这时候是不会执行/etc/profile的
问题是:此事使用切换用户执行了哪些文件?
经过测试,以下文件都没有执行(注意:只要切换后手动去打开终端以下才会执行):
/etc/profile
/home/test1/.bash_profile
/home/test2/.bashrc
/etc/bashrc
----------------------------------
我的问题是,切换用户执行了哪些文件?
#5
猜测,纯属猜测
启动就是图形登陆界面的话X估计是gdm/xdm之类的脚本用特定系统权限运行的。
桌面和窗口管理器都是从用户登录的sesison继承权限
如果这样的话
图形下的切换用户,就只是用新身份启动了新的桌面和窗口管理器。
建议图形方式两个用户各开一个gedit,然后看pstree的输出,找两个gedit的共同祖先
启动就是图形登陆界面的话X估计是gdm/xdm之类的脚本用特定系统权限运行的。
桌面和窗口管理器都是从用户登录的sesison继承权限
如果这样的话
图形下的切换用户,就只是用新身份启动了新的桌面和窗口管理器。
建议图形方式两个用户各开一个gedit,然后看pstree的输出,找两个gedit的共同祖先
#1
/etc/profile
/home/用户名/.bash_profile
/home/用户名/.bashrc
/etc/bashrc
还有/home/用户名/桌面的配置文件
/home/用户名/.bash_profile
/home/用户名/.bashrc
/etc/bashrc
还有/home/用户名/桌面的配置文件
#2
在/etc/bashrc里面有做终端判断的:
# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
# are we an interactive shell?
if [ "$PS1" ]; then
if [ -z "$PROMPT_COMMAND" ]; then
case $TERM in
xterm*)
if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
else
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
fi
;;
screen)
if [ -e /etc/sysconfig/bash-prompt-screen ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
else
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
fi
;;
*)
[ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
;;
esac
fi
# Turn on checkwinsize
shopt -s checkwinsize
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
# You might want to have e.g. tty in prompt (e.g. more virtual machines)
# and console windows
# If you want to do so, just add e.g.
# if [ "$PS1" ]; then
# PS1="[\u@\h:\l \W]\\$ "
# fi
# to your custom modification shell script in /etc/profile.d/ directory
fi
# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
# are we an interactive shell?
if [ "$PS1" ]; then
if [ -z "$PROMPT_COMMAND" ]; then
case $TERM in
xterm*)
if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
else
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
fi
;;
screen)
if [ -e /etc/sysconfig/bash-prompt-screen ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
else
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
fi
;;
*)
[ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
;;
esac
fi
# Turn on checkwinsize
shopt -s checkwinsize
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
# You might want to have e.g. tty in prompt (e.g. more virtual machines)
# and console windows
# If you want to do so, just add e.g.
# if [ "$PS1" ]; then
# PS1="[\u@\h:\l \W]\\$ "
# fi
# to your custom modification shell script in /etc/profile.d/ directory
fi
#3
通过桌面点击后台不是运行哪些基本的配置文件吗?
#4
-------------------------------------
先对两位表示感谢,我的问题是这样的:
我的机子上有两个用户:test1,test2
首先我登录test1,我知道此事会执行/etc/profile(用su切换的时候也会执行)
-->切换用户,切换用户的时候test1打开的内容不会关闭。
-->登录test2,由于是首次登录肯定会执行/etc/profile
-->再切换到test1,这时候是不会执行/etc/profile的
问题是:此事使用切换用户执行了哪些文件?
经过测试,以下文件都没有执行(注意:只要切换后手动去打开终端以下才会执行):
/etc/profile
/home/test1/.bash_profile
/home/test2/.bashrc
/etc/bashrc
----------------------------------
我的问题是,切换用户执行了哪些文件?
#5
猜测,纯属猜测
启动就是图形登陆界面的话X估计是gdm/xdm之类的脚本用特定系统权限运行的。
桌面和窗口管理器都是从用户登录的sesison继承权限
如果这样的话
图形下的切换用户,就只是用新身份启动了新的桌面和窗口管理器。
建议图形方式两个用户各开一个gedit,然后看pstree的输出,找两个gedit的共同祖先
启动就是图形登陆界面的话X估计是gdm/xdm之类的脚本用特定系统权限运行的。
桌面和窗口管理器都是从用户登录的sesison继承权限
如果这样的话
图形下的切换用户,就只是用新身份启动了新的桌面和窗口管理器。
建议图形方式两个用户各开一个gedit,然后看pstree的输出,找两个gedit的共同祖先