[SOLVED] KNOPPIX Linux - User's Home Directory Not Getting Created
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
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.
Distribution: On my PC I use RHEL, at office AIX, Solaris, HP-UX, RHEL.
Posts: 254
Rep:
KNOPPIX Linux - User's Home Directory Not Getting Created
Hi Guys,
I have just installed KNOPPIX Linux on a Virtual Machine. This Linux Distro is great in the sense that I didn't find any difficulty in running its Live CD and then installing it.
Well, so here I am. I created a couple of user accounts but no directory was created for them under /home directory. Here's an example:
Code:
root@Microknoppix:~# useradd x
root@Microknoppix:~# passwd x
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@Microknoppix:~# ls /home
knoppix
root@Microknoppix:~# su - x
No directory, logging in with HOME=/
x@Microknoppix:/$ ls
KNOPPIX bin debian etc lib mnt proc sbin srv tmp var
Sept boot dev home media opt root selinux sys usr vmlinuz
x@Microknoppix:/$
As it can be seen from the above output that no home directory was created for the user. Yet, the user can create files and can do any work.
So, I looked at the file: /etc/default/useradd and uncommented the following line:
Code:
# The default home directory. Same as DHOME for adduser
HOME=/home
Of course, /home is already in existance!
So, what could it be wchich is causing the problem? Where can the user's home directry be going then?
From: man useradd: -m, --create-home
Create the userīs home directory if it does not exist. The files
and directories contained in the skeleton directory (which can be
defined with the -k option) will be copied to the home directory.
Distribution: On my PC I use RHEL, at office AIX, Solaris, HP-UX, RHEL.
Posts: 254
Original Poster
Rep:
Thanks for your help! Yes, it works!
Code:
root@Microknoppix:/home/knoppix# useradd -m x
Creating mailbox file: File exists
root@Microknoppix:/home/knoppix# userdel -r x
userdel: /var/mail/x not owned by x, not removing
root@Microknoppix:/home/knoppix# useradd -m x
Creating mailbox file: File exists
root@Microknoppix:/home/knoppix# su - x
x@Microknoppix:~$
x@Microknoppix:~$ ls
x@Microknoppix:~$ ls /home
knoppix x y
x@Microknoppix:~$
Distribution: On my PC I use RHEL, at office AIX, Solaris, HP-UX, RHEL.
Posts: 254
Original Poster
Rep:
Well, there is a problem now. The users which I created previously, for example: the account of the user x
I delete it recursively and then create it again as shown below:
Code:
root@Microknoppix:/home/knoppix# userdel -r x
userdel: /var/mail/x not owned by x, not removing
root@Microknoppix:/home/knoppix# ls /home
knoppix y
root@Microknoppix:/home/knoppix# useradd -m x
Creating mailbox file: File exists
root@Microknoppix:/home/knoppix# ls /home
knoppix x y
root@Microknoppix:/home/knoppix#
Kindly, consider the underlined lines in the commands and their outputs given above. If we are to remove the mail box manually then how do we do that?
Distribution: On my PC I use RHEL, at office AIX, Solaris, HP-UX, RHEL.
Posts: 254
Original Poster
Rep:
I think I have found it:
Code:
root@Microknoppix:~# find / -name mail
/var/mail
/var/spool/mail
/usr/lib/gimp/2.0/plug-ins/mail
^C
root@Microknoppix:~# ls /var/mail/
hi x y
root@Microknoppix:~# ls /var/spool/mail/
hi x y
root@Microknoppix:~# rm -rf /var/mail/x
root@Microknoppix:~# rm -f /var/spool/mail/x
root@Microknoppix:~# ls /var/mail
hi y
root@Microknoppix:~# ls /var/spool/mail/
hi y
root@Microknoppix:~# userdel -r x
root@Microknoppix:~# ls /home
knoppix y
root@Microknoppix:~# useradd -m x
root@Microknoppix:~# passwd x
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@Microknoppix:~# ls /home
knoppix x y
root@Microknoppix:~# su - x
x@Microknoppix:~$ ls
x@Microknoppix:~$
Distribution: On my PC I use RHEL, at office AIX, Solaris, HP-UX, RHEL.
Posts: 254
Original Poster
Rep:
Thanks again! adduser command is great! So, I would like to use the useradd command as a short-hand.
Code:
root@Microknoppix:~# adduser --force-badname Me
Allowing use of questionable username.
Adding user `Me' ...
Adding new group `Me' (1003) ...
Adding new user `Me' (1003) with group `Me' ...
Creating home directory `/home/Me' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for Me
Enter the new value, or press ENTER for the default
Full Name []: Dev
Room Number []: Heaven
Work Phone []: 0000
Home Phone []: 0000
Other []: 0000
Is the information correct? [Y/n] Y
root@Microknoppix:~# ls /home
Me knoppix x y
root@Microknoppix:~#
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.