So...you've decided to make that shinny, new Ubuntu 12.04 server of yours into an NIS client. You've gone through all the necessary steps to install and set up NIS, AutoFS, and NFS. Yet for some reason (which will be made obvious soon), neither you nor anyone else with NIS credentials can:
- Edit, delete, create, or copy any files they owned before NIS was set up.
- Get their home directory (for example: /home/username) auto-mounted.
Could not chdir to home directory /home/username: Permission denied
-bash: /home/username/.bash_profile: Permission denied
Permission denied?! What gives, brah?
Let's check the permissions of all the home directories. At the command line, run the following command:
ls -l /home
You will get output that will look similar to this:
drwx--S--- 15 username username 4096 Dec 31 15:04 username/
:
:
:
Apparently, the permissions on the home directory are restrictive such that there are no read, write, or execute bits for group (g+rwx). Since username (in your case might be something different) is most likely not a valid NIS group (depending on how you set up your NIS groups), there's no way you'll be able to access your home directory; let alone auto-mount it.
Let's check and compare one other thing; the User IDs (UID) of username on the NIS server we are trying to authenticate with and on our troublesome NIS client. Alternatively, if you do not have access to the NIS server, you can check the UID of username on another NIS client that does work. At the command line of both machines, run the following command:
getent passwd username
The output from our troublesome NIS client will look similar to this:
username:x:1000:1000:username,,,:/home/username:/bin/bash
The output from the same command, ran on our NIS server (or working NIS client), will look similar to this:
username:x:34528:1000:username,,,:/home/username:/bin/bash
Notice how the UIDs are different. The UID, of username, on the NIS server is (in this case) 34528. Whereas on our NIS client, the UID is 1000. The UIDs of username do not match and they must be changed so that they do. Plus, the group called username, which is local to our troublesome NIS client must be deleted as well. Otherwise, the local group (username) will be used instead of the appropriate group that is provided by our NIS server.
Before we start making changes to important files, let's back them up first. Just in case!
sudo cp /etc/passwd /etc/passwd_BACKUP
sudo cp /etc/group /etc/group_BACKUP
Now, let's fix this problem.
- sudo vim /etc/passwd [Personally, I like to use vim. However, you can user whatever text editor your like.]
- Locate the line for the username in question. In this case, it's username.
- Edit the UID of username so that it matches the UID of username from our NIS server. In this case, the UID of 1000 should be changed to 34528.
- Save and exit your text editor.
- Back at the command line, edit /etc/group: sudo vim /etc/group
- Locate the line for the username group. It should look like this: username:x:1000:
- Delete this line.
- Save and exit your text editor.
- Reboot your NIS client: sudo shutdown -r now
No comments:
Post a Comment