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 - 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, 10:32 PM   #1
linuxmantra
Member
 
Registered: Dec 2013
Posts: 113

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 10:34 PM.
 
Old 04-21-2014, 11:16 PM   #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, 12: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, 01:22 AM   #4
kooru
Senior Member
 
Registered: Sep 2012
Posts: 1,385

Rep: Reputation: 275Reputation: 275Reputation: 275
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, 07:15 AM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
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, 11:33 AM   #6
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

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

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, 10:41 AM   #8
linuxmantra
Member
 
Registered: Dec 2013
Posts: 113

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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:35 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