How to update groups w/o re-logging in?



  • 1. fill a (cd|dvd) up efficently
    back in the old (dos) days, I used to have a utility which would, given a group of files to backup, would efficiently fill up a floppy disk. I would like to put together something similar in bash for burning blank single sided data DVDs. so basically say I have a couple hundred files ranging from 10MB to 1000MB. I would like to do something like the following: ./ . #the following files occupy 4.61 GB of disk space #+and should fit on a single sided data dvd. /home/myname/data/file234234.dat /home/myname/data/file2342345344.dat /home/myname/data/file234345234.dat /home/myname/data/file2233454534234.dat /home/myname/data/file2342534234.dat /home/myname/data/file2342543234.dat hope that makes sense... I will monitor this thread closely... so if I am unclear, feel free to ask me questions. thanks in advance.
  • 2. Backspace and Delete key mappings
    I have read much on the subject of these 2 keys. Yet I have not been able to do what I need to do. I need the backspace key to generate 0x08(^H) and the delete key to generate 0x7f(del) during the execution of a single application. On all my linux boxes the backspace generates 0x7f(^?) and the del key generates ^[[3~. I need to be able to change that before I execute my program then change it back when my application is done. stty does NOT do the job nor does my application use termdef. I have found a little expect script that does do what I need. I execute "script program" and the keys come out like I want. #!/usr/bin/expect eval spawn -noecho $argv interact { \177 {send "\010"} "\033\[3~" {send "\177"} However I am really looking for basic Linux commands that can be executed from the bash shell that will do the same thing or a method of making my application do it from within its self. Thanks and regards Mark
  • 3. some problem about unix cmd "export"
    I can use the cmd export well. ex:export abc=100 and i can use set or export to see the variable abc abc=100 but when i write it in a shell. ex: shell tt, chmod 777 tt content of tt: export abc=100 execute: tt and i can't see the variable abc when i type set or export cmd. Can anyone tell me why ? or give me some ref.. thx~
  • 4. Time for Background Processes
    Greetings, How can I find a time taken by a background process to complete? I mean I have a script which is doing aroun 5-6 background jobs. Just wants to know the time taken by each of these background processes to complete? any help would be appreciated. TIA
  • 5. Need to check timing statistics
    Greetings, I want to run a command and after its execution needs to know its timing statistics like elapsed time etc. Can anyone help me on this? TIA

How to update groups w/o re-logging in?

Postby 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?



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?

Postby 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.


Re: How to update groups w/o re-logging in?

Postby 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?

Postby 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 DuBois   XXXX@XXXXX.COM   KC6QKZ/AE   http://www.**--****.com/ ~spcecdt/

Re: How to update groups w/o re-logging in?

Postby 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

Re: How to update groups w/o re-logging in?

Postby 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?

Postby 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.


Re: How to update groups w/o re-logging in?

Postby 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).


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

iptables rules:

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
msn_packets  tcp  --  anywhere             anywhere           tcp
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
# 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
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

Return to unix


Who is online

Users browsing this forum: No registered users and 98 guest