Solved

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

Posted on 2014-01-16
4
1,618 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

Save on storage to protect fatherhood memories

You're the dad who has everything. This Father's Day, make sure your family memories are protected. My Passport Ultra has automatic backup and password protection to keep your cherished photos and videos safe. With up to 3TB, you have plenty of room to hold the adventures ahead.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

911 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

17 Experts available now in Live!

Get 1:1 Help Now