-4

Which files will be created when using the command useradd ?

I know that it will modify /etc/passwd, /etc/group, and /etc/shadow and that it copies home/skel to the user's home directory. I want to know which files such as (say) .bash_logout are created by default.

closed as unclear what you're asking by Kusalananda, dr01, Thomas, user88036, GAD3R Sep 21 '18 at 16:34

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    It's unclear what you mean. There are several files created, modified and copied. What is the issue you are facing? Are you asking because you want to bypass useradd? – Kusalananda Sep 21 '18 at 7:46
  • This question is answered in detail in the man page. – Wildcard Sep 21 '18 at 7:47
  • I know /etc/passwd , /etc/group , /etc/shadow will modify and home/skl will copy user's home directory. – Rahul Raj Sep 21 '18 at 7:48
  • My question is which file will be create by default e.g - .bash_logout – Rahul Raj Sep 21 '18 at 7:50
  • 1
    See the manual. It will mention something called a "skeleton directory" (/etc/skel). This would be used if -m is used with useradd. – Kusalananda Sep 21 '18 at 8:03
1

As said by @Kusalananda, useradd -m rahul will create a new user rahul and set up his home directory. The files contained there are the ones defined in the skeleton dir /etc/skel. For instance on my system this dir contains:

[dr01@centos7 ~]$ ls -lap /etc/skel
total 28
drwxr-xr-x.   3 root root   92 May 16 10:17 ./
drwxr-xr-x. 143 root root 8192 Sep 21 09:46 ../
-rw-r--r--.   1 root root   18 Apr 11 02:53 .bash_logout
-rw-r--r--.   1 root root  193 Apr 11 02:53 .bash_profile
-rw-r--r--.   1 root root  231 Apr 11 02:53 .bashrc
drwxr-xr-x.   4 root root   39 Mar 19  2018 .mozilla/
-rw-r--r--.   1 root root  658 Aug  2  2017 .zshrc

This directory is referenced in useradd's manpage.

Not the answer you're looking for? Browse other questions tagged or ask your own question.