LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   KNOPPIX Linux - User's Home Directory Not Getting Created (http://www.linuxquestions.org/questions/linux-server-73/knoppix-linux-users-home-directory-not-getting-created-757810/)

Hi_This_is_Dev 09-25-2009 07:06 PM

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?

MrChilly0 09-25-2009 08:14 PM

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.


so...it'd be : useradd -m yourloginname

Hi_This_is_Dev 09-26-2009 04:59 PM

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:~$


repo 09-26-2009 05:01 PM

try adduser.
It's a script which let you create the home directory, password, etc

Hi_This_is_Dev 09-26-2009 05:04 PM

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?


Thanks in advance!

Hi_This_is_Dev 09-26-2009 05:17 PM

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:~$


Hi_This_is_Dev 09-26-2009 06:12 PM

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:~#



All times are GMT -5. The time now is 05:53 AM.