user join to a new group and effect right now without logout

user join to a new group and effect right now without logout

If you modified your own user account while logged in with it, the changes will not have an effect until you next login.

If you don’t want to logout, you can replace your current BASH shell with a new one to achieve the same thing by running the follow:

# su -m -c “$(which $SHELL) –login -i" $(whoami)

This will switch-user to yourself, replacing your current shell with a new instance of itself. You will be prompted for your password.

If you don’t specify a command to run you’ll probably get an error to the effect of “cannot execute bash: file not found” because it won’t be on the environment. You could use –shell to point su at it, but your shell wouldn’t be a “login” shell and therefore won’t read your .bash_profile etc.

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

Google+ photo

You are commenting using your Google+ account. Log Out / 變更 )

連結到 %s