How to update groups w/o re-logging in?
by kj » Tue, 13 Sep 2005 23:58:51 GMT
I have been added to a new group by our sysadmin, but my *existing*
shell sessions don't recognize it (new sessions do). Is there a
way to tell my *existing* shell sessions about the new group, so
that, e.g., it shows in the output of the "groups" command?
Thanks!
kj
--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
Re: How to update groups w/o re-logging in?
by Stephane Chazelas » Wed, 14 Sep 2005 01:11:43 GMT
[...]
No, only super-users can add supplementary groups do an existing
process, the only thing you can do to add groups to one process
is exec a setuid command that will add those new groups to the
process, and then switch back to your user id and exec a new
shell. The process id will be preserved but not the shell (a
new one will be started).
That's what login does. So, "exec login" will do what you want
but will ask your login/passwd again and will start a new shell.
See man setgroups.
Note that /etc/group is not special in anyway as far as the
operating system is concerned. It's just login commands that use
it to initialise the list of groups of the login process
(shell) (and applications such as ls that use it to translate
group ids to names).
The operating system is only concerned with user and group ids
of processes and files.
--
Stephane
Re: How to update groups w/o re-logging in?
by Chris F.A. Johnson » Wed, 14 Sep 2005 01:44:13 GMT
In each shell session, do:
su - $USER
--
Chris F.A. Johnson < http://www.**--****.com/ >
==================================================================
Shell Scripting Recipes: A Problem-Solution Approach, 2005, Apress
< http://www.**--****.com/ ~chris/books/cfaj/ssr.html>
Re: How to update groups w/o re-logging in?
by spcecdt » Wed, 14 Sep 2005 02:33:32 GMT
In article <dg453b$b65$ XXXX@XXXXX.COM >,
Try "newgrp". It will start a new shell, but the shell will be part of the
same shell session.
John
--
John DuBois XXXX@XXXXX.COM KC6QKZ/AE http://www.**--****.com/ ~spcecdt/
Re: How to update groups w/o re-logging in?
by matt_left_coast » Wed, 14 Sep 2005 03:10:26 GMT
That would be a new shell. It would be in the same terminal window, but it
would still be a new shell. The question is about the _existing_ shell.
As far as I know, There is no way for a user to add a group to an existing
shell.
--
Re: How to update groups w/o re-logging in?
by Keith Thompson » Wed, 14 Sep 2005 04:27:42 GMT
Stephane Chazelas < XXXX@XXXXX.COM > writes:
[...]
It's not entirely clear (to me) what is and is not part of the
"operating system". I think the point is that the *kernel* is only
concerned with user and group ids of processes and files.
--
Keith Thompson (The_Other_Keith) XXXX@XXXXX.COM < http://www.**--****.com/ ~kst>
San Diego Supercomputer Center <*> < http://www.**--****.com/ ~kst>
We must do something. This is something. Therefore, we must do this.
Re: How to update groups w/o re-logging in?
by Enrique Perez-Terron » Wed, 14 Sep 2005 13:48:35 GMT
It seems you will have to write a kernel module to do it - if you are
running a kernel that you can modify. If you do, you may even be able
load the new module without rebooting your kernel or terminating your
existing shells. :)
I am not aware of any system call to add groups to a running process
other than the process doing the call. So I think that even the
root user cannot add groups to a random running process.
-Enrique
Re: How to update groups w/o re-logging in?
by Stephane CHAZELAS » Wed, 14 Sep 2005 16:05:43 GMT
2005-09-12, 19:27(+00), Keith Thompson:
You're right, the term was not easy to choose. I was considering
OS as opposed to applications. It's only the applications (some
of which may be considered as part of the OS in your definition
of OS) and the libc for instance that deal with /etc/group,
/etc/passwd,shadow... and user/group *names*, not the OS (OS
kernel in your definition).
--
Sthane
Similar Threads:
1.Supplemental Groups after logging in
I have very bizarre behavior on an SCO Unix 5.0.5 system. Some users
get all of their supplemental groups set upon logging in. Others
don't. There does not seem to be any rhyme or reason to this. The
/etc/group file is in perfect shape (as reported by grpck). I don't
even touch this file by hand...I use the scoadmin command to administer
it. The authck -a command runs without error too.
For the users that do not get all of their supplemental groups set (a
number that is well below the kernel setting NGROUPS), using the "sg -a
group" command does work, as does the "newgrp" shell built-in. What I
would like to know is what would cause two different users, each a
member of a supplemental group, to have one assigned the supplemental
group automatically and the other not.
Thanks in advance.
D. Hopkins
2.Trouble with logging iptables LOG into a .log file
I am a system administrator in a middle school and a linux
enthusisastic newbie and have just installed a RH9 box as Default
Gateway using iptables as firewall.
Recently students started finding MSN replicas and are using them. It
is a school policy not to allow MSN and I need to stop it. I can find
the exe files of MSN easy enough but need to close the MSN traffic on
user level and that means the firewall.
I understand that closing the port 1863 (MSN) is to no awail since MSN
is smart enough to find other ports like 80 to connect. So I need to
sniff out the hosts of MSN for IP blocking and am trying to do so with
these
iptables rules:
Chain FORWARD (policy ACCEPT)
target prot opt source destination
msn_packets tcp -- anywhere anywhere tcp
spt:1863
------
Chain msn_packets (1 references)
target prot opt source destination
LOG all -- anywhere anywhere LOG level
warning ip-options prefix `MSN packet:
'
At first, after making the LOG rule I could not find the log file for
iptables, then after some reading, curtesy of Google, I made these
adjustments to syslog.conf (bottom entry) after creating the file
/var/log/iptables.log.
-------------
# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.* /dev/console
(bla bla, default settings by Red Hat 9)
# Iptables - messages
#*.info;kern.!warning;mail.none;authpriv.none;cron.none
/var/log/iptables.log
kern.warning /var/log/iptables.log
-------------------------
Nothing happens! Not with kern.warning nor with the commented line
with #*.info;kern etc. uncommented.
How do I get iptables to log into the /var/log/iptables.log file when
the LOG rule is activated?
BTW the file iptables.log contains the same text as /var/log/messages
and I just don't seem to find these info by Google.
I'm in dire need for some help here folks.
Sigurjon, the Icelandic binary Viking net-surfer.
(the answer is 42:)
3.ANN: The Open Group online UNIX store updates
4.Update: Chicago OpenSolaris User Group meeting Oct 20th
5.New COMPUTER updated discussion groups. 1 Million posts