LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 07-21-2005, 05:23 PM   #1
primorec
Member
 
Registered: Sep 2004
Distribution: RH5.2, RH6.2, RH8.0, RH 9.0, RHEL 3.0,MDK 10.1, KNOPPIX3.6, Solaris 8, Solaris 9, CentOS 3x-4x-5x, U
Posts: 62

Rep: Reputation: 15
how to refresh shell environment and remain sane


How can a user refresh his/her current shell environment after, for example, sysadmin adds him/her to another group ?

EXAMPLE:
groups command gives for the user joe this
548 palace:~ > groups
power lp neptune saruman

sysadmin adds joe to the group proj

If joe types groups on one of existing terminals the result is the same as from above. He is not a member of group proj

Of course, if the user telnets to itself, he/she will see proj as a part of his group

549 palace:~ > telnet palace
Trying 10.188.27.17...
Connected to palace.
Escape character is '^]'.
Red Hat Desktop release 3 (Taroon)
Kernel 2.4.21-20.EL on an i686
login: joe
Password:
Last login: Thu Jul 21 14:55:29 from palace.XXX.XXX
501 palace:~ > groups
power lp neptune saruman proj

============================
So, I am repeating the question:
How can user refresh his/her current shell environment after, for example, sysadmin adds him/her to another group ?

Sincerely

Igor

P.S: sourcing .login does not help
sourcing .cshrc does not help

of course, rsh to palace works too ... but this is just a workaround ( like telnet )

Last edited by primorec; 07-21-2005 at 06:25 PM.
 
Old 07-21-2005, 05:54 PM   #2
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
You must 'relogin'. The group information is only read at login time. 'bash -l' for the bash shell SHOULD do this, but I have not tested it. I usually just log out and log back in myself.
 
Old 07-21-2005, 06:18 PM   #3
primorec
Member
 
Registered: Sep 2004
Distribution: RH5.2, RH6.2, RH8.0, RH 9.0, RHEL 3.0,MDK 10.1, KNOPPIX3.6, Solaris 8, Solaris 9, CentOS 3x-4x-5x, U
Posts: 62

Original Poster
Rep: Reputation: 15
Nope. It does not work. I am using tcsh. "tcsh" does have "-l" option as well (like bash).... but it does not make any difference to the "groups".
Yes, I know, "log out" "log in" sequence works... Unfortunately,
I can not use it. Long story why... end result is... I can not execute "log out" "log in" procedure.
 
Old 08-09-2005, 05:39 PM   #4
jpywtora
LQ Newbie
 
Registered: Aug 2005
Distribution: Debian
Posts: 8

Rep: Reputation: 0
how to refresh shell environment and remain sane

How about:

exec su - <username>

Once there to run X application do:
DISPLAY=:0.0 xcalc
or whatever you need to run. I tested this and it worked, the user was in the just added group.
 
Old 08-09-2005, 07:03 PM   #5
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
Can someone not in the wheel group su to themselves even?
 
Old 08-09-2005, 09:14 PM   #6
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,766

Rep: Reputation: 306Reputation: 306Reputation: 306Reputation: 306
In bash, we have the 'source' command, which can be used to reload an environment config file and have the changes take effect immediately, without re-login.

Studying the tcsh man pages, I see a 'source' command, but it does something completely different.

I don't see another command which does something similar to the bash source command.

I'm afraid you will have to bite the bullet and just re-login after making changes to the environment, unless you can find something I missed.
 
Old 08-09-2005, 09:36 PM   #7
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
Quote:
Originally posted by bigrigdriver
In bash, we have the 'source' command, which can be used to reload an environment config file and have the changes take effect immediately, without re-login.
You still won't be able to get a new group added to your login. That's handled by (either) PAM or login. Once per login.
 
Old 08-09-2005, 11:01 PM   #8
primorec
Member
 
Registered: Sep 2004
Distribution: RH5.2, RH6.2, RH8.0, RH 9.0, RHEL 3.0,MDK 10.1, KNOPPIX3.6, Solaris 8, Solaris 9, CentOS 3x-4x-5x, U
Posts: 62

Original Poster
Rep: Reputation: 15
Re: how to refresh shell environment and remain sane

Quote:
Originally posted by jpywtora
How about:

exec su - <username>

.
Yesssssssss... this hint did the trick. This command refreshes the current SHELL.
This is exactly the command I was looking for.

Thanks, thanks thanks again...
 
Old 08-09-2005, 11:09 PM   #9
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
jpywtora, that was a brilliant solution. Absolutely brilliant.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to install firefox 1.0 on REDHAT 8 and remain sane primorec Linux - Software 23 02-25-2005 02:17 AM
HOWTO build gerbv (gerber viewer) on RH8 and remain sane primorec Linux - Software 4 01-27-2005 05:11 PM
How to install gambas on REDHAT 8 and remain sane primorec Linux - Software 0 12-29-2004 12:42 PM
How to connect to the network with knoppix on IBM Thinkpad T21 and remain sane ? primorec Linux - Laptop and Netbook 0 12-12-2004 11:17 AM
Sub shell environment variables tnine9 Programming 1 06-08-2004 01:27 PM


All times are GMT -5. The time now is 03:05 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration