LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 02-18-2024, 06:06 PM   #1
coltson
Member
 
Registered: Oct 2010
Posts: 149

Rep: Reputation: 3
Directory for new user not created


Hi. When I add a new user, I also try to add a new home dir for it in /home. I use:
Code:
sudo useradd -s /bin/bash -g clfs -d /home/clfs clfs
However a clfs dir is not created in /home. Giving a look in /etc/passwd, I have this line:
Code:
clfs:x:1001:1001::/home/clfs:/bin/bash
So what is going wrong here?
 
Old 02-18-2024, 06:17 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,264
Blog Entries: 24

Rep: Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195
Quote:
Originally Posted by coltson View Post
Hi. When I add a new user, I also try to add a new home dir for it in /home. I use:
Code:
sudo useradd -s /bin/bash -g clfs -d /home/clfs clfs
However a clfs dir is not created in /home. Giving a look in /etc/passwd, I have this line:
Code:
clfs:x:1001:1001::/home/clfs:/bin/bash
So what is going wrong here?
From man useradd:

Code:
   -d, --home-dir HOME_DIR
       The new user will be created using HOME_DIR as the value for the user's
       login directory. The default is to append the LOGIN name to BASE_DIR and
       use that as the login directory name. The directory HOME_DIR does not 
       have to exist but will not be created if it is missing.
Use -m instead for default directory, or -m with -d for non-default location (see man page)

Last edited by astrogeek; 02-18-2024 at 06:27 PM. Reason: format quote
 
1 members found this post helpful.
Old 02-19-2024, 03:48 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,855

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
see also adduser (instead of useradd)
https://manpages.debian.org/unstable...user.8.en.html
 
  


Reply

Tags
user account



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't automatically create an empty directory when new user is created. jimb.smith CentOS 2 04-02-2017 11:02 AM
changing home directory permission in user management after user created in suse(KDE) hamedhsn Linux - Security 4 04-06-2011 09:18 PM
Formating FAT32, but linux created FAT32 is not like win created FAT32?? Difference? boki15 Linux - Newbie 19 07-21-2010 04:41 AM
[SOLVED] KNOPPIX Linux - User's Home Directory Not Getting Created Hi_This_is_Dev Linux - Server 6 09-26-2009 05:12 PM
Created user in Webmin - how to lock that user in specified directory? guest Linux - Security 1 04-18-2009 07:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 07:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration