Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2716
  • Last Modified:

Why is the .bash_profile not created?

I am trying to install the oracle 10g software. Before running Oracle Universal Installer, I need to prepare the oracle user's environment. So I first created following accounts and groups:

groupadd netman
groupadd dba

useradd -g dba -G netman -d /oracle/oracle -m -s /bin/bash oracle
useradd -g netman -G dba -m -d /opt/netadmin -s /bin/bash netadmin

After creating, I need to edit the oracle user's login file on the database server so that the environment will be configured automatically on login. The users should be "orcale" and "netadmin" I just created. The login file should be ".bash_profile". However, in either user's login directory, I could not find the ".bash_profile" file. What I have found are the following files:

.base_history
.profile
local.cshrc
local.login
local.profile.

The ".profile" is supposed for Bourne or Korn shell. Also what are the three local files for?
0
gs_kanata
Asked:
gs_kanata
  • 5
  • 2
  • 2
  • +3
2 Solutions
 
mrjoltcolaCommented:
bash will use .profile if it exists, but it will prefer .bash_profile, so if you have both, it will use .bash_profile only

So just use .profile

You can also add ORACLE config params into /etc/profile so it is global to the system, if that works for your policies, it usually works for me. I set ORACLE_SID, ORACLE_HOME, PATH and LD_LIBRARY_PATH globally and only need to do it once. Typically any users with logins to my Oracle servers will need the oracle config.

Otherwise, if you have custom profiles you want useradd to make use of, create it under /etc/skel and useradd will copy it to the new user directory (assuming you used -m option)

0
 
mrjoltcolaCommented:
You can also use -k in conjunction with -m, if you want to maintain multiple skeletons (DBA vs NON-DBA users)

useradd -m -k /etc/skel_dba ...

useradd -m -k /etc/skel_nondba ...

Then you can use separate profiles under each that will get copied depending on which skeleton you specify. This is really overkill if you just have a small system.


0
 
TintinCommented:
local.cshrc and local.login are the default templates for csh, you'd need to remove the 'local' from the filename to make them active (for csh/tcsh).

Same deal for local.profile, but for sh, ksh and bash.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
gs_kanataAuthor Commented:
The ".profile" file did not exist as the new created home directory was not there before creation. I deleteed the user "oracle" with command "userdel -r oracle" to make sure that its home directory removed as well. Then I created it again, but it is same, there is no ".base_profile".
0
 
osintsevCommented:
When your create a new account everythign in the skeleton directories is copied to user's homedir. This is why you have all the default login environment files.

The skeleton path on most systems is /etc/skel. By default, a set of initialization files for each of the shells are copied from the /etc/skel directory into a user account's $HOME directory and renamed, list of these files are not dependent on the user's shell you specify with useradd.

local.cshrc, local.login and local.profile files are templates, you can delete them without any consequences.
0
 
TintinCommented:
I assume that was a typo and you meant .bash_profile instead of .base_profile

You are correct, useradd won't create .bash_profile default.  You need to do it manually or put it into /etc/skel or a unique skeleton directory as shown by mrjoltcola.
0
 
mrjoltcolaCommented:
Did you try my suggestion? useradd will copy whatever is in /etc/skel, and it does on most Linux systems by default, out of the box. If it does not do this on your system, likely it was removed, or it is a distribution with which I am not familiar.

ls -la /etc/skel

Does this show .bash_profile? If not, please try the suggestion, create /etc/skel/.bash_profile and put your content in it, then test useradd again. I am positive it will create the .bash_profile in the new user after this.

0
 
mrjoltcolaCommented:
Clarification, every recent Linux system in past years I have setup has /etc/skel/.bash_profile
0
 
sonicefuCommented:
you can find .bash_profile in the /home/oracle

and you can see it after showing the hidden files
0
 
osintsevCommented:
As far as I can see, the system is similar to Sun Solaris, so the existence of /etc/skel/.bash_profile by default for me is not so obvious.
0
 
gheistCommented:
What is your operating system?
.absh_profile is present only on Linux, for others it is usually .profile
0
 
mrjoltcolaCommented:
@osintsev: Good point, I had to re-read the thread to find how I assumed Linux was the OS. I don't know where I got Linux from, I'm sure I glanced at the zones and "saw" Linux, but now after re-reading, I see it is not, and I also see the OP did not say, and I injected that bit myself.

My apologies. So I still contend the solution is the same, but not that it is obvious. If the OP wants .bash_profile created, he creates on in the skel, or works with .profile.

When I've used the GNU add-on CDs or built bash manually for other OSes (Solaris, AIX) I just use .profile. I suppose using .bash_profile is good for using extended syntax that bourne might not handle?
0
 
gheistCommented:
Actually there are parts of ksh syntax bash is not good at. It is better to keep it simple on any system if you ever have to change.
I prefer pdksh - autocomplete, history, and standard syntax.
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

  • 5
  • 2
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now