Find the answer to your Linux question:
Results 1 to 3 of 3
I don't quite understand /etc/skel. I know that everything in /etc/skel will effect all NEW users, and that's about it. Basically, what I'm trying to do is add the directories ...
  1. #1
    Just Joined!
    Join Date
    Jan 2011
    Posts
    87

    How do I add directories to a new users /home?

    I don't quite understand /etc/skel. I know that everything in /etc/skel will effect all NEW users, and that's about it.

    Basically, what I'm trying to do is add the directories "home" and "work" to the users /home directory.

    How do I do this?

  2. #2
    Linux Newbie
    Join Date
    Nov 2008
    Location
    Tokyo, Japan
    Posts
    243
    Well, the /etc/skel files is specifically used by the "useradd" command, so you must use that command to create a user account.

    If you already have a user account, and you want to add directories to it, it is very simple:
    Code:
    sudo -u some_guy mkdir /home/some_guy/work 
    sudo -u some_guy mkdir /home/some_guy/home
    The "sudo -u username" lets you execute commands like "mkdir" as if you were the user "username". You could also do an interactive "sudo" session like this.
    Code:
    sudo -i -u some_guy
    ###Now you are executing commands as if you were the user "some_guy".
    cd
    mkdir work
    mkdir home
    exit
    ###Now you are back to your old self again

  3. #3
    Linux Engineer nujinini's Avatar
    Join Date
    Apr 2009
    Posts
    1,229
    Quote Originally Posted by ramin.honary View Post
    Well, the /etc/skel files is specifically used by the "useradd" command, so you must use that command to create a user account.

    If you already have a user account, and you want to add directories to it, it is very simple:
    Code:
    sudo -u some_guy mkdir /home/some_guy/work 
    sudo -u some_guy mkdir /home/some_guy/home
    The "sudo -u username" lets you execute commands like "mkdir" as if you were the user "username". You could also do an interactive "sudo" session like this.
    Code:
    sudo -i -u some_guy
    ###Now you are executing commands as if you were the user "some_guy".
    cd
    mkdir work
    mkdir home
    exit
    ###Now you are back to your old self again
    Hello,

    I personally liked the way you explain it. Thank you!
    nujinini
    Linux User #489667

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...