Help! Adding user with a specific home directory that already exists
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Help! Adding user with a specific home directory that already exists
Hey everyone,
Im trying to add users to my nfs server with a specific home directory that already exists. Can this be done? I've done some research on google and other forums but cant seem to find the answer. Maybe I'm searching the wrong question, im not sure, anyway any help would be great!
Im trying to add users to my nfs server with a specific home directory that already exists. Can this be done? I've done some research on google and other forums but cant seem to find the answer. Maybe I'm searching the wrong question, im not sure, anyway any help would be great!
[root@MRB home]# useradd -d /mnt/sdb/home/10aielmi/ 10aielmi
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
Creating mailbox file: File exists
[root@MRB home]# su 10aielmi
bash: /mnt/sdb/home/10aielmi//.bashrc: Permission denied
[root@MRB home]# useradd -d /mnt/sdb/home/10aielmi/ 10aielmi
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
Creating mailbox file: File exists
[root@MRB home]# su 10aielmi
bash: /mnt/sdb/home/10aielmi//.bashrc: Permission denied
Can you please check if that home directory is already in use by some other user? Or may be the user already exists, check the /etc/passwd file to be sure.
Last edited by Sayan Acharjee; 04-09-2010 at 07:33 AM.
i know that they are not in use. heres whats goin on: i backed up the home directory to a hard drive before i reinstalled. i upgraded to fc12 and hooked that backup drive with home on it as a slave drive. i set that drive to be mounted to /mnt/sdb. the path of the home directory is /mnt/sdb/home.
there is about 30 users in the home directory i need to make an account for that all need to use those directories. Maybe something inside of the user home directories needs to be removed. i dont know.
i know that they are not in use. heres whats goin on: i backed up the home directory to a hard drive before i reinstalled. i upgraded to fc12 and hooked that backup drive with home on it as a slave drive. i set that drive to be mounted to /mnt/sdb. the path of the home directory is /mnt/sdb/home.
there is about 30 users in the home directory i need to make an account for that all need to use those directories. Maybe something inside of the user home directories needs to be removed. i dont know.
Ok, now I know why its giving that weird error. When you are trying to add a new user with that directory as home directory its trying to copy the necessary files from /etc/skel to that directory and as these files are already there its resulting that error.
Create a user first then change its home directory by editing the /etc/passwd file, see if it works.
Last edited by Sayan Acharjee; 04-09-2010 at 07:53 AM.
[root@MRB home]# su 10aielmi
bash: /mnt/sdb/home/10aielmi//.bashrc: Permission denied
You need to give the user not only the same name as the old one but the same user ID, too. That's the number in the 3rd field of the /etc/passwd line for the user. Or you could chown the files.
If it was my personal system (where I don't mind breakage to learn things) I'd copy the lines for those 30 users from the old passwd and shadow files to the new one ... take care (make sure you can always get back to where you started).
You might have similar issues with group names/numbers. Useful to create any new groups with same numbers as old system if copying files from old system.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.