LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   User's Home Directory (https://www.linuxquestions.org/questions/linux-desktop-74/users-home-directory-4175451114/)

rock18 02-21-2013 08:13 AM

User's Home Directory
 
Hi All,

I have RHEL 5.1 and i want to create a user with already exist Directory where i have some files and i am not getting user's deafult directory(.bashrc,.bash_history).

so please help i am new in Linux .

1)-[root@server ora]# pwd
/new/ora

2)-[root@server ora]# du -sh .
486M .

3)-[root@server ora]#useradd -m -d /new/ora ora
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.

4)-[root@server ora]# finger ora
Login: ora Name: (null)
Directory: /new/ora Shell: /bin/bash
Never logged in.
No mail.
No Plan.

5)-[root@server ora]# ls -l
total 4
drwxrwxrwx 2 root root 4096 Feb 21 14:15 DNS Tutorial


But no file related to this "ora" user.

TB0ne 02-21-2013 10:36 AM

Quote:

Originally Posted by rock18 (Post 4896686)
Hi All,
I have RHEL 5.1 and i want to create a user with already exist Directory where i have some files and i am not getting user's deafult directory(.bashrc,.bash_history). so please help i am new in Linux .

First, be aware that RHEL 5.1 is VERY old...the latest is 6.3, and that if you're using RHEL, you need to be paying for it. Things like this are well covered in Red Hat's knowledlegebase.
Quote:

1)-[root@server ora]# pwd
/new/ora
2)-[root@server ora]# du -sh .
486M .
3)-[root@server ora]#useradd -m -d /new/ora ora
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
Since you're new to Linux, you need to read the man pages on commands. That alone will save you lots of time and headaches, since just typing in "man useradd" will tell you ALL the options, what they mean, and how they work. In the case of what you typed in, you're telling the system to use the /new/ora directory...and CREATE the /new/ora directory. Since it already exists, it can't be created, so it tells you that and fails. So, either remove the /new/ora directory, and let useradd create it, or omit the "-m" flag.

Chances are, you'll have to run the userdel command to remove the "ora" user first, since it already exists.
Quote:

4)-[root@server ora]# finger ora
Login: ora Name: (null)
Directory: /new/ora Shell: /bin/bash
Never logged in.
No mail.
No Plan.

5)-[root@server ora]# ls -l
total 4
drwxrwxrwx 2 root root 4096 Feb 21 14:15 DNS Tutorial
But no file related to this "ora" user.
Nope...again, it failed because of the already-existing directory, and the -m flag. Also, the man page on ls would help, since the command you entered, wouldn't show any hidden files. That's "ls -a".


All times are GMT -5. The time now is 04:29 PM.