LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 10-19-2021, 03:04 AM   #1
LinuGeek
Member
 
Registered: Jun 2008
Posts: 126

Rep: Reputation: 0
Non existent Group/group-id on Linux


Hello Experts,


A normal user tries to login onto Linux (SuSE) System who has his/her account on it. What happens if somehow the primary group which it belongs to, does not exist.
Will the system allow him to get in simply because his account exist or will it deny access?
I have tested this on a test system...I created a local user and changed his group-id to some arbitrary number in /etc/passwd File. The system still allows him to login without any problem and id command shows his primary group as this nonexistent number. So I feel system has no problem what so ever if his group-id has any meaningful association on system. Is it really so?
Does this as well hold true for NIS or LDAP Authentications?
Thanx in advance.

Regards,
Admin
 
Old 10-19-2021, 05:34 AM   #2
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,628
Blog Entries: 19

Rep: Reputation: 4464Reputation: 4464Reputation: 4464Reputation: 4464Reputation: 4464Reputation: 4464Reputation: 4464Reputation: 4464Reputation: 4464Reputation: 4464Reputation: 4464
AFAIK the kernel and the filesystem are concerned only with UID and GID. The user and group names are for the convenience of humans. Any program that needs to show a name uses /etc/passwd or /etc/group to find out what the name is. Otherwise, it uses some substitute. For example, if your user creates files and then uses ls -l to list them, you will see the group owner given as a number.

In LFS, when you first chroot into your new system, you get the bash prompt "I have no name" because there is no /etc/fstab as yet, so bash doesn't know that user 0 should be called root. But you still have full root powers because that goes with with the UID 0.

Last edited by hazel; 10-19-2021 at 05:35 AM.
 
1 members found this post helpful.
Old 10-19-2021, 08:03 AM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,676
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
Correct: a group-id (like a user-id) is a number. If that number is not listed in /etc/groups then it will show only as a number and will not have a name.
 
Old 10-20-2021, 01:34 AM   #4
LinuGeek
Member
 
Registered: Jun 2008
Posts: 126

Original Poster
Rep: Reputation: 0
Thanks Hazel and sundialsvcs for your replies. I agree that the system recognises User Accounts with IDs and not with names. But my question was, what if that GID (Group) does not exist on the system at all?

For example for testing if I create a group called city with gid 1011 and create a user called sam with primary group city. And then later, delete that group(and its GID) will that user be able to login as its primary group does not exist.

It seems from my tests , he was still able to login. Ofcourse when he created files, they all have now 1011 as their gids. But login is permitted.
 
Old 10-20-2021, 03:19 AM   #5
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
Quote:
Originally Posted by LinuGeek View Post
For example for testing if I create a group called city with gid 1011 and create a user called sam with primary group city. And then later, delete that group(and its GID) will that user be able to login as its primary group does not exist.
No, you still don't get it. What you have deleted is the record in /etc/group that just assigned a human readable name to the GID (well, technically, /etc/group can do more, but not in this case). The home directory of sam is still owned by the GID 1011 even if it doesn't have a name now. Check it with
Code:
ls -ld ~sam
Also, if you look it up in /etc/passwd, you'll see that the primary GID of sam is still 1011:
Code:
getent passwd sam

Last edited by shruggy; 10-20-2021 at 04:30 AM.
 
2 members found this post helpful.
Old 10-20-2021, 01:43 PM   #6
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,676
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
"A group" is "a group-id." That is to say, it is a number. If you associate a name with that number you will see it listed by name. But it can actually be any number that you want. Its only purpose is with permission-checking. There is no physical or logical resource otherwise associated with "a group."

"User ids" are also numbers, but they have to appear in the (shadow ...) password table. Users also have other characteristics and resources associated with them, such as "home directories." And, a list of group-ids.

Last edited by sundialsvcs; 10-20-2021 at 01:44 PM.
 
1 members found this post helpful.
Old 10-24-2021, 07:08 AM   #7
LinuGeek
Member
 
Registered: Jun 2008
Posts: 126

Original Poster
Rep: Reputation: 0
Thank you all (hazel, shruggy & sundialsvcs) for your valuable comments and suggestions. It is now clear. This Post can be marked as closed.
 
  


Reply



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
[SOLVED] ia32-libs needed for Mp560 install ..Non Existent --> Arch Linux .. Any suggestions ? jv2112 Linux - Newbie 2 08-20-2012 04:24 AM
Kde menu has non-existent Gnome entries Haiyadragon Linux - Software 1 01-27-2005 03:28 AM
Formatting failed, now my fat32 windows partition is non-existent. zimzam Mandriva 12 12-28-2004 06:51 PM
Mutt sorts non existent mail ernobe Debian 0 12-17-2004 08:18 AM
Our mail server is being flooded with email address to non-existent recipients. gaslq Linux - Networking 5 12-14-2004 08:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:10 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration