![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Filesystems, Disks and Memory Discuss NAS, SAN, RAID, Robotic Libraries, backup devices, RAM, DRAM, SCSI, IDE, EIDE topics here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Monkcast #12: IBM HW group OEMs Solaris to chagrin of SW group & a ... - ZDNet.com bl | iBot | UNIX and Linux RSS News | 0 | 08-17-2007 05:30 PM |
| Changing userID and Changing group and GID | deal732 | Shell Programming and Scripting | 2 | 04-18-2007 11:09 AM |
| File group ownership changing automatically | top_gun | UNIX for Advanced & Expert Users | 1 | 12-09-2005 03:37 PM |
| entry in /etc/group too long - problem using sudo with %group | poli | SUN Solaris | 4 | 12-21-2004 09:50 AM |
| Changing the Effective Group ID | Jody | UNIX for Dummies Questions & Answers | 2 | 12-05-2002 03:53 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
changing group ID
My current GID are all < 100, however I am having issues now with this. Does anyone know of a way to change all GID's to perhaps add 100, IE so GID now = 23 will = 123. I am running an NIS network so changing the table is easy , however finding all the files on all my filesystems and modifying them is what i need to find if there is an easy way to do this.....
Frank |
|
||||
|
The best way to do this is with PERL. Perl can walk a file system faster than anything else. Do something like this.
#!/opt/perl/bin/perl use File::Find; find \&wanted, "/"; sub wanted { my $dev; # the file system device number my $ino; # inode number my $mode; # mode of file my $nlink; # counts number of links to file my $uid; # the ID of the file's owner my $gid; # the group ID of the file's owner my $rdev; # the device identifier my $size; # file size in bytes my $atime; # last access time my $mtime; # last modification time my $ctime; # last change of the mode my $blksize; # block size of file my $blocks; # number of blocks in a file #Right below here your telling lstat to retrieve all this info on each and every file/directory. Each and every file/directory is w ritten to $_. (($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = lstat($_)); if ($gid <= "99" ) { $NEWGID=$gid+99; print "old $gid\n"; print "new $NEWGID\n"; system "chgrp $NEWGID $_; } } I'm not sure if this is perfect but it should be pretty close. -X |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|