Operating System - HP-UX
1752793 Members
6045 Online
108789 Solutions
New Discussion юеВ

Re: Can't edit group file: lines too long

 
SOLVED
Go to solution
Brian Atkins
Advisor

Can't edit group file: lines too long

I imported a group file from a 10.20 system to my 11.00 system and I need to edit several groups, but can't. grpck reports that several lines are too long and when I vi the file and 'j' down to the entries, vi gives me:
INTERNAL ERROR: VREDRAW
:
All commands are unsuccessful to get me out of that mode.
5 REPLIES 5
Kofi ARTHIABAH
Honored Contributor
Solution

Re: Can't edit group file: lines too long

try:

strings group > new_groups
vi new_groups
cp new_groups group

strings will remove any special characters that may have crept in to join lines together.

nothing wrong with me that a few lines of code cannot fix!
Madhu Sudhan_1
Respected Contributor

Re: Can't edit group file: lines too long

May I know which method you used to import?

...Madhu
Think Positive
Brian Atkins
Advisor

Re: Can't edit group file: lines too long

Madhu,
I used:
rcp -r -p :/etc/group :/etc/group.bak

Then vi'ed /etc/group.bak to remove the info I didn't want and ammended it to /etc/group using:
cat /etc/group.bak >> /etc/group
James R. Ferguson
Acclaimed Contributor

Re: Can't edit group file: lines too long

Brian:

Try fixing your /etc/group file with the 'fold' filter (see man pages) to format the file into records that 'vi' can then handle and repair.

From the man pages, The length of each line in /etc/group is limited to LINE_MAX, as defined in . The maximum number of users per group is (LINE_MAX - 50)/9.

If you have a large number of users per group, split them into multiple lines by repeating the group, like:

users::20:tom,dick,harry....
users::20:able,baker,charlie....

...JRF...
Bill Hassell
Honored Contributor

Re: Can't edit group file: lines too long

The /etc/group file does *NOT* need to keep a record of the user's default group found in /etc/passwd. Many revisions ago this was true and the LINE TOO LONG error was created when SAM would blindly concatenate more user ID's on the same line.

Since the default user group is groupID=20 and known as users, then the only information needed about users is:

users::20:

As mentioned in a previous note, if a large number of users are members of another group, you can repeat the group line as many times as needed.

As always, use the grpck command to verify the validity of /etc/.


Bill Hassell, sysadmin