I am adding users using the command useradd in opensuse 12.1 and creating a home directory on NFS. The problem here is the home directory's owner is root instead of user.
msvlsi67:~ # useradd -g users -d /export/home/raj67 -m raj67
useradd: Warning: chown on `/export/home/raj67' failed: Invalid argument
Cannot change owner/group for `/export/home/raj67': Invalid argument
Cannot change permissions for `/export/home/raj67/.emacs': Invalid argument
Cannot change permissions for `/export/home/raj67/.bashrc': Invalid argument
Cannot change permissions for `/export/home/raj67/.inputrc': Invalid argument
Cannot change permissions for `/export/home/raj67/.xinitrc.template': Invalid argument
Cannot change permissions for `/export/home/raj67/bin': Invalid argument
Cannot change permissions for `/export/home/raj67/.local': Invalid argument
Cannot change permissions for `/export/home/raj67/.xim.template': Invalid argument
Cannot change permissions for `/export/home/raj67/.vimrc': Invalid argument
Cannot change permissions for `/export/home/raj67/.config': Invalid argument
Cannot change permissions for `/export/home/raj67/.bash_history': Invalid argument
Cannot change permissions for `/export/home/raj67/.fonts': Invalid argument
Cannot change permissions for `/export/home/raj67/.profile': Invalid argument
Cannot change permissions for `/export/home/raj67/public_html/.directory': Invalid argument
Cannot change permissions for `/export/home/raj67/public_html': Invalid argument
useradd: Copying of skel directory failed.
msvlsi67:/export/home # ll |grep raj67
drwxr-xr-x 2 root root 4096 Apr 12 2012 raj67
msvlsi67:/export/home #
I tried adding users using the GUI but still the owner is root. using chown for home directory also gave the same error.
Could anyone please help in fixing this issue?
Thank you.
It seems to me that a few things are the possible culprit. It appears that root on the client does not match root on the NFS server and is potentially disallowed from altering ownership of files either from a UID perspective or who owns /export on the NFS server.
The issue here has nothing to do with the
useradd
command itself because as you stated in the comments you cannotchown
files/folders from the client on the export at all. This can be due to the way it was exported, a UID/GID mismatch, or how the ownership of the folder is set up on the server side.As I previously mentioned you can check the permissions of the folder server-side, and look for UID/GID mismatches and make sure the ownership of the exported folder is correct. Be sure to re-export the folder and re-mount it any time you change a setting to ensure it takes effect. You may also consider setting anonuid=0,anongid=0.
One last thing is that if you are using NFSv4 try it using NFSv3 to see if the problem happens there (nfsvers=3).
A lot of OpenSuse specific troubleshooting information on this very topic is in a thread I found here on the opensuse forums, although they did not appear to resolve the issue.