LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 04-21-2014, 11:32 PM   #1
linuxmantra
Member
 
Registered: Dec 2013
Posts: 104

Rep: Reputation: Disabled
Can't find users in home directory


usually home directory of user is /home/username.When I type # cd /home and long list the file,I see all the users. But here happens two case

1. lets say user tom, I types # id tom, its shows the tom information(UID,GID etc). But I can't see the tom in /home directory. I even tried # grep tom /etc/passwd, no information available. what to do?

2. I created a user with # useradd -M <user-name>. user is created but this user is not present under /home. How would I set/make home directory for this user as /home and that I can see this user.

Thank you.

Last edited by linuxmantra; 04-21-2014 at 11:34 PM.
 
Old 04-22-2014, 12:16 AM   #2
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
my man page for useradd (fedora) says:
Code:
       -M
           Do not create the user's home directory, even if the system wide setting from /etc/login.defs (CREATE_HOME) is set to yes.
 
Old 04-22-2014, 01:44 AM   #3
Automatic
Member
 
Registered: Mar 2013
Posts: 42

Rep: Reputation: Disabled
Quote:
Originally Posted by Berhanie View Post
my man page for useradd (fedora) says:
Code:
       -M
           Do not create the user's home directory, even if the system wide setting from /etc/login.defs (CREATE_HOME) is set to yes.
Indeed, command you're looking for is '-m', not '-M'. Capitalization is important in pretty much every computer system out there, 'm' and 'M' and completely different characters.
 
Old 04-22-2014, 02:22 AM   #4
kooru
Senior Member
 
Registered: Sep 2012
Posts: 1,385

Rep: Reputation: 273Reputation: 273Reputation: 273
As said by Automatic, -m and -M are different:

Code:
       -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.

           By default, if this option is not specified and CREATE_HOME is not
           enabled, no home directories are created.

       -M
           Do no create the user's home directory, even if the system wide
           setting from /etc/login.defs (CREATE_HOME) is set to yes.
 
Old 04-22-2014, 08:15 AM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,601

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
This can also happen when using things like NIS or LDAP to hold login information. The login data exists, but the account on the specific system doesn't.
 
Old 04-22-2014, 12:33 PM   #6
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 2,321
Blog Entries: 1

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
useradd by default does not create the /home/ folder. Using adduser is preferred as it does the extras by default.
 
Old 04-23-2014, 11:38 AM   #7
linuxmantra
Member
 
Registered: Dec 2013
Posts: 104

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
This can also happen when using things like NIS or LDAP to hold login information. The login data exists, but the account on the specific system doesn't.

Yes you are right. If the user is under IdM ( Identity Management) then user information (#id <user name>) can be seen but can't be seen in /home directory which is the defautl home directory. In order to see the user in /home directory, we need to do
#cp -rp /etc/skel/ <user-name>

The user will be seen in /home directory. And this was the reason why I earlier did not see the user in /home directory. So, in IdM user can be granted read only access which I camed to know while working in this issue with the team in my office.
 
Old 04-23-2014, 11:41 AM   #8
linuxmantra
Member
 
Registered: Dec 2013
Posts: 104

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Automatic View Post
Indeed, command you're looking for is '-m', not '-M'. Capitalization is important in pretty much every computer system out there, 'm' and 'M' and completely different characters.
I can create user with -M option (-M does not create home directory) as #useradd -M <user name> , proble with doing this is, this user can't be seen in /home directory. In order to see the user in /home directory we need to do
#cp -rp /etc/skel/ <user name>

Now, you can see user in /home directory.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Restrict Users to their Home DIrectory ghandizzle8 Linux - Newbie 6 02-08-2012 05:18 PM
Users Home Directory rahmad Linux - Server 7 07-31-2008 03:24 AM
Users can only see home directory bluenix Linux - General 20 03-12-2005 09:51 AM
multi users on the same home directory rpinatel Linux - General 2 09-05-2003 12:55 PM
2 users, 1 mailbox and 1 home directory keevitaja Linux - Newbie 3 08-15-2002 09:20 PM


All times are GMT -5. The time now is 08:55 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration