Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I just did something pretty simple. Given a user user, I modified his user id, primary group's id, and added him to a new group in order to make my server use the same uid and gid as another server which shares files with this server over NFS. (I was told that I needed to do this in order to keep permissions from going insane on the shared files.)

What I did is the following:

groupadd -g 2000 mygroup
groupmod -g 1500 user
usermod -u 500 -g 1500 -G 1500,2000 user

This accomplished the following:

  1. The user's ID now matches the remote user's ID so NFS permissions will work.
  2. The user's primary group ID now matches the remote user's primary group ID.
  3. The user now belongs to group mygroup which the remote user is also a part of.

Now, unfortunately, I can't su -l user, as I get the following error:

grep: /var/cpanel/users/user: Permission denied

I don't think that I did anything wrong, as when I id user, then everything looks fine:

uid=500(user) gid=1500(user) groups=1500(user),2000(mygroup)

What gives? Why am I getting this cPanel-ish error? What did I do wrong here/forget to do?

EDIT

It seems that I'm able to get into the user's account, I just get that error every time I su -l user.

share|improve this question

2 Answers 2

Given that you can log in as the user, then get this error message, the message is probably coming from the user's initialization files (/etc/profile, ~/.profile, ~/.bash_profile or similar). Try tracing these profile scripts; as the user in question, run

bash --login -x
share|improve this answer
up vote 1 down vote accepted

I had changed a user's ID and primary group's ID, which broke things in permissions.

For a user user with a primary group of user, here's what the permissions were on the folder in question:

-rw-r-----  1 root  500  671 Oct  4 05:48 user

Since I had modified the group's id, it didn't get updated here, which broke permissions.

I simply did chown -R root:user /var/cpanel/users/user to fix the problem.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.