9

Several files in my home directory have been disappearing. E.g. .bashrc, .bash_profile, authorized_keys and now .profile.

Regardless of how this happened, I would like to restore the original pristine .profile file. If I create a new user on my system one is created. Where can I find this .profile contents from a fresh, untouched install?

gertvdijk
  • 67,947
Jay
  • 205

1 Answers1

10

In /etc/skel/. This is the user "skeleton" used when creating a new user. On a regular Ubuntu installation it looks like this:

/etc/skel
├── .bash_logout
├── .bashrc
└── .profile

If you add files here yourself it will be put in the home directory of newly created users. To restore the default, simply copy it from there:

cp /etc/skel/.profile ~/

Se also the useradd manpage on this:

The system administrator is responsible for placing the default user files in the /etc/skel/ directory (or any other skeleton directory specified in /etc/default/useradd or on the command line).

-k, --skel SKEL_DIR The skeleton directory, which contains files and directories to be copied in the user's home directory, when the home directory is created by useradd.

While strictly not in scope for your question, but noteworthy is, also the system-wide profile file (/etc/profile) is evaluated on login as Johankor mentions in his answer.

gertvdijk
  • 67,947