-   Linux - Newbie (
-   -   Linux user location/directoires (

abhi7514 11-08-2012 09:26 PM

Linux user location/directoires
I need to create a user. I know it sounds simple but I'm having a slight issue with it. For example I want to create user1 with home location of /home/projects/user1. I went ahead and created the projects directory using mkdir under /home, and also user1 directory under /projects, but whenever I use the ls -l command to check the structure, the user1 shows under home and nothing under /home. I'm not sure What I'm doing wrong.

Also if I wanted to create a directory under user1, should I simply type: mkdir /home/projects/user1/usrdir ??? Is there a better or simpler way?

I still a newbie, so please if anyone could point me at the right direction, I would really appreciate it.

Thanks in advance.

catkin 11-08-2012 09:42 PM

Is the desired home directory /home/projects/user1 or /projects/user1?

How did you use vi to create /projects/user1?

What is the output of tree -d -L 1 / and tree -d -L 1 /home ?

Yes, mkdir /home/projects/user1/usrdir is a good way to create that directory, best done as user1 to get the right ownerships. Alternatively you could do it using a graphical file manager.

Didier Spaier 11-08-2012 09:52 PM

Let's say you begin with only the /home directory and didn't yet create /home/projects nor its sub-directories

Let me quote "man mkdir":

      mkdir - make directories

      mkdir [OPTION]... DIRECTORY...

      Create the DIRECTORY(ies), if they do not already exist.

      Mandatory arguments to long options are mandatory for short options too.

      -m, --mode=MODE
              set file mode (as in chmod), not a=rwx - umask

      -p, --parents
              no error if existing, make parent directories as needed

So I would simply type:

mkdir -p /home/projects/user1/usrdir
It would help if you say which distribution you use as some provide specific commands that can be handy.

abhi7514 11-08-2012 11:42 PM

Sorry for the typo, and thanks
Sorry for the typo, I had vi in my mind at the time I typed the question. I think I figured out most of it. in fedora linux, whenever you create a new user, it by default puts it under the /home directory. Everything made sense after that. Thanks guys for your input. I appreciate it.

Didier Spaier 11-09-2012 01:07 AM


Originally Posted by abhi7514 (Post 4825500)
in fedora linux, whenever you create a new user, it by default puts it under the /home directory.

That is the case in any Linux distribution which uses the "useradd" command either directly or through a wrapper script or a graphical interface, see "man useradd".

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