1

When I am trying to su to a user I get errors that the names for associate group and user IDs cant be found.

The when I id the same user (while logged in with it) it says no such user But when I id the same user again while logged in as root, it shows associated groups along with their names.

[root@hostname01 work]# sudo su someuser
/usr/bin/id: cannot find name for group ID 100
/usr/bin/id: cannot find name for user ID 44556
[I have no name!@hostname01 work]$ id someuser
id: ‘someuser’: no such user
[I have no name!@hostname01 work]$ exit
exit
[root@hostname01 work]# id someuser
uid=44556(someuser) gid=100(users) groups=100(users),1000(someuser)
[root@hostname01 work]#

I guess somewhere there is a permission issue, but I am not sure where and what is making it impossible for a user to id itself.


Permissions on /etc/passwd and /etc/group:

-rw-r--r--.   1 root     root       1615 Nov 10 02:30 passwd
-rw-r--r--.   1 root     root        743 Nov 10 02:30 group
6
  • Permissions on /etc/passwd and /etc/group? Nov 20, 2022 at 0:56
  • 2
    BTW, you don't need to run su with sudo. su someuser (or su - someuser if you wanted a login shell & environment) would work just as well...as would sudo -u someuser -i
    – cas
    Nov 20, 2022 at 1:11
  • @JamesRisner updated in question. Nov 20, 2022 at 2:25
  • 1
    You are perhaps hitting special environment restrictions, such as SELinux or containerization. Could you give more description about your system? Version, kernel, anything you know is special (user from LDAP/AD, VM, container, host provider etc.)? Does the same happen if you temporarily relax SELinux (setenforce Permissive)?
    – A.B
    Nov 20, 2022 at 10:32
  • Are you using something other than files (/etc/passwd|group|shadow) for the nameservice? Whats in you nsswitch.conf file? Is this a vm / baremetal / container?
    – symcbean
    Jan 23 at 16:01

1 Answer 1

1

If you are using AD to authenticate, could be that in sshd config you do not have enabled parameter auto_private_groups = true and after login OS is not able to create private group what is needed to chmod /home/user to correct permissions. Check:

/etc/sssd/sssd.conf

[domain/YOUR_DOMAIN]
...
# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/windows_integration_guide/gid-for-ad-users
# virtual private groups
auto_private_groups = true

than restart sssd and re-login.

1
  • 1
    This is only required to activate the automatic creation of user private groups, but the error says it cannot find the name even for the uid. It doesn't explain why id someuser works for root, but doesn't work for the user itself.
    – aviro
    Jan 23 at 9:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .