Solved

how to create user and assign home directoy to the existing directory

Posted on 2014-01-16
4
1,580 Views
Last Modified: 2014-02-08
Dear Experts:

I am having redhat enterprise linux 6 working as crm server the implementer have created the directory /var/www/html/crm

now iam interested to create the user named crm and the home directory of the user crm should be /var/www/html/crm.

can you please suggest on how to do this, this is production server.

Thanks in advance.
0
Comment
Question by:D_wathi
  • 2
4 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 250 total points
ID: 39784841
As root:

useradd -d /var/www/html/crm crm

passwd crm


The above uses the defaults except for the home directory. Run

useradd -D

to see these defaults.
0
 

Author Comment

by:D_wathi
ID: 39784954
thank you very much, did test with the below

tried the below

useradd -g tom4 -G apache,ws15 -d /var/www/html/tom4 tom4
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.

think since the directory tom4 was already there hence the above warning can be ignored or should it be manually copy files from /etc/skel please suggest
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39784978
This depends on whether you need shell initialization files (.profile, .bashrc) for the new user.

I think your CRM implementer will have their own profiles to use for the application users, but if this is not the case you can simply copy .profile and/or .bashrc from /etc/skel.
Don't forget to change the ownership to the new user/group after copying!

Both files do not contain important things yet, they're meant to be customized by you anyway.
".profile" sources "/etc/profile" if it hasn't already been called, so this might be worth to be considered.

Another possible (but not at all mandatory) initialization file is .exrc (for vi), which might be useful.
0
 
LVL 13

Assisted Solution

by:Sandy
Sandy earned 250 total points
ID: 39788110
Simple way is create the user and then modify /etc/passwd with correct home directory for this user and yes you need to modify directory permissions accordingly in case you are not allowed to change user/group owner then enable acl and add this user as owner with required permissions.

TY/SA
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now