Results 1 to 7 of 7

Thread: useradd does not create a home directory

  1. #1

    Default useradd does not create a home directory

    Peace,
    Code:
    cat /etc/passwd
    privelegedrooter:x:1033:100::/home/priveledgedrooter:/bin/bash
    [CODE]sudo usermod -d /home/priveledgedrooter priveledgedrooter
    Code:
    usermod: no changes
    When logging in
    Code:
    Using username "priveledgedrooter".
    Have a lot of fun...
    Could not chdir to home directory /home/priveledgedrooter: No such file or directory
    is the only right way to create a user is to do it through yast?

  2. #2
    Join Date
    Dec 2008
    Location
    FL, USA
    Posts
    3,373
    Blog Entries
    1

    Default Re: useradd does not create a home directory

    From their man page heads:

    usermod - modify a user account

    useradd - create a new user or update default new user information
    Reg. Linux User #211409 *** multibooting since 1992
    Primary: 15.3, TW, 15.1 & 13.1 on Haswell
    Secondary: eComStation (OS/2) &15.2 on i965P w/ Radeon
    Tertiary: Debian, Fedora, Mageia, more on Rocket Lake & older Intel, AMD, NVidia &&&&&

  3. #3
    Join Date
    Feb 2018
    Location
    Romania
    Posts
    484

    Default Re: useradd does not create a home directory

    It is explained better than I could (I do not understand what you want, sorry):
    https://wiki.archlinux.org/index.php/users_and_groups

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,777

    Default Re: useradd does not create a home directory

    I see nowhere in your post that you created the user through useradd, let alone which options/parameters you used.

    I see nowhere in your post that /home/priveledgedrooter realy does not exist, e.g. by
    Code:
    ls -l /home/priveledgedrooter
    The only thing I see is that you try to change the home directory to the same one, which apparently usermod seeing this and not doing anything, let alone creating it anew.

    I assume most people use the YaST module for this, but useradd should work also of course.
    Henk van Velden

  5. #5

    Default Re: useradd does not create a home directory

    Your thread title mentions usreadd, but all of your examples use usermod.

    With useradd, at least, you must add the -m option to have it no only
    specify, but also create, the home directory. This may be what you wanted
    all along, but now that you have the user just create the directory and
    remember next time to create properly with "useradd -m username":

    Code:
    mkdir /home/priveledgedrooter
    chmod 700 /home/priveledgedrooter
    Note that the chmod above is my personal preference, and not the normal
    SUSE thing to do.

    --
    Good luck.

    If you find this post helpful and are logged into the web interface,
    show your appreciation and click on the star below.

    If you want to send me a private message, please let me know in the
    forum as I do not use the web interface often.

  6. #6

    Default Re: useradd does not create a home directory

    I forgot the other obvious command:

    Code:
    chown privelegedrooter: /home/privelegedrooter

    --
    Good luck.

    If you find this post helpful and are logged into the web interface,
    show your appreciation and click on the star below.

    If you want to send me a private message, please let me know in the
    forum as I do not use the web interface often.

  7. #7
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    32,336
    Blog Entries
    15

    Default Re: useradd does not create a home directory

    On Thu 24 May 2018 12:00:21 PM CDT, ab wrote:

    I forgot the other obvious command:

    Code:
    chown privelegedrooter: /home/privelegedrooter

    Hi
    For user add use the -m option to create the home directory eg;
    Code:
    useradd -m privelegedrooter
    With usermod it's the -d or -m option for new directory or move
    contents as well....

    --
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SLES 15 RC4 | GNOME Shell 3.26.2 | 4.12.14-18-default
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •