cancel
Showing results for 
Search instead for 
Did you mean: 

Create user

Raoof
Regular Advisor

Create user

Dear Experts,

 

 

Need to create user like oracle who can run the envi files (.oraenv and .asmenv) which is under /u01/oracle, cron jobs, cluvfy, srvctl utilies.

 

I don't want user to user oracle userid.

 

Will be really grateful for the advices and solution.

 

Regards

13 REPLIES
Dennis Handly
Acclaimed Contributor

Re: Create user

>Need to create user like oracle who can run the envi files (.oraenv and .asmenv) which is under /u01/oracle, cron jobs, cluvfy, srvctl utilities.  I don't want user to user oracle userid.

 

You may have problems with permissions if you don't use the same numeric ID.  But you could try another user in the same group.

Raoof
Regular Advisor

Re: Create user

Dear Dennis,

 

Thanks for your response. As i am newbie in the ux box so will be really grateful if you could please give some more details with the steps. You can find below the user account related files.

 


###########    /etc/passwd    ###############

$ vi /etc/passwd

"/etc/passwd" [Read only] 21 lines, 870 characters
root:9MICcmvROHatk:0:3::/:/sbin/sh
daemon:*:1:5::/:/sbin/sh
bin:*:2:2::/usr/bin:/sbin/sh
sys:*:3:3::/:
adm:*:4:4::/var/adm:/sbin/sh
uucp:*:5:3::/var/spool/uucppublic:/usr/lbin/uucp/uucico
lp:*:9:7::/var/spool/lp:/sbin/sh
nuucp:*:11:11::/var/spool/uucppublic:/usr/lbin/uucp/uucico
hpdb:*:27:1:ALLBASE:/:/sbin/sh
nobody:*:-2:-2::/:
www:*:30:1::/:
smbnull:*:101:101:DO NOT USE OR DELETE - needed by Samba:/var/opt/samba/nologin:/bin/false
cimsrvr:*:102:102:WBEM Services:/var/opt/wbem:/sbin/sh
sfmdb:*:103:20::/home/sfmdb:/sbin/sh
sshd:*:104:103:sshd privsep:/var/empty:/bin/false
iwww:*:105:1::/home/iwww:/sbin/sh
owww:*:106:1::/home/owww:/sbin/sh
hpsmh:*:107:104:System Management Homepage:/var/opt/hpsmh:/sbin/sh
tftp:*:108:105:Trivial FTP user:/home/tftp:/usr/bin/false
oracle:3FK0hm3iKFkjU:2009:2002::/u01/oracle:/sbin/sh

 

###########    /etc/group    ###############

$ vi /etc/group

"/etc/group" [Read only] 19 lines, 279 characters
root::0:root
other::1:root,hpdb
bin::2:root,bin
sys::3:root,uucp
adm::4:root,adm
daemon::5:root,daemon
mail::6:root
lp::7:root,lp
tty::10:
nuucp::11:nuucp
users::20:root
nogroup:*:-2:
smbnull::101:
cimsrvr::102:
sshd::103:
hpsmh::104:
tftp::105:
dba::2001:oracle
oinstall::2002:

 

########

 

Please do the needful.

 

Regards

Dennis Handly
Acclaimed Contributor

Re: Create user

>please give some more details with the steps. You can find below the user account related files.

 

If you want to use a different name but same UID, you can just use vipw(1m) to clone the line:

oracle2:3FK0hm3iKFkjU:2009:2002::/u01/oracle:/sbin/sh

 

If you want an new user with the same GID but UID 20090:

oracle2:3FK0hm3iKFkjU:20090:2002::/u01/oracle:/sbin/sh

 

And in /etc/group:

dba::2001:oracle,oracle2

Raoof
Regular Advisor

Re: Create user

 

Thanks for your response.

 

## If you want to use a different name but same UID, you can just use vipw(1m) to clone the line:

     oracle2:3FK0hm3iKFkjU:2009:2002::/u01/oracle:/sbin/sh

 

## If you want an new user with the same GID but UID 20090:

     oracle2:3FK0hm3iKFkjU:20090:2002::/u01/oracle:/sbin/sh

 

From the above steps, is that necessary to have same uid or guid or can have different one while creating the user same like oracle. And also as am a newbie will be really grateful if you could please show me how to use vipw(1m) to clone the line.

 

## And in /etc/group:

     dba::2001:oracle,oracle2

 

Regarding adding the user in groups file, i should only assign to dba group or to oinstall also?

dba::2001:oracle
oinstall::2002:

 

Thanks & Regards

Dennis Handly
Acclaimed Contributor

Re: Create user

## If you want to use a different name but same UID, you can just use vipw(1m) to clone the line:
     oracle2:3FK0hm3iKFkjU:2009:2002::/u01/oracle:/sbin/sh
## If you want an new user with the same GID but UID 20090:
     oracle2:3FK0hm3iKFkjU:20090:2002::/u01/oracle:/sbin/sh

>From the above steps, is that necessary to have same uid or guid or can have different one while creating the user same like oracle.

 

If you use the same UID/GID, you don't have to worry about permissions since they are the same user.  You can use different home directories and shells.  But be careful about removing this user, use vipw to remove.

But you do want the same GID.

 

>if you could please show me how to use vipw(1m) to clone the line.

 

It should be the same as vi, except you type (as root) vipw.

## And in /etc/group:
     dba::2001:oracle,oracle2
>Regarding adding the user in groups file, I should only assign to dba group or to oinstall also?

 

You only need to assign it to dba, oracle's secondary group.  The primary group oinstall is already mentioned in /etc/passwd.

Raoof
Regular Advisor

Re: Create user

I just wanted to thank you for taking the time to reply me in such a prompt manner. I really appreciate your assistance I'll give it a try and will get back to you asap.

 

Thanks again.

Raoof
Regular Advisor

Re: Create user

 

I added the below line in /etc/passwd file with same UID ang GID but different username.

 

     newuser:3FK0hm3iKFkjU:2009:2002::/newuser:/sbin/sh

 

And in /etc/group:

 

     dba::2001:oracle,newuser


But when i tried to run envi file's i.e. (.oraen and .asmenv) from the newuser home directory i.e. /newuser as a newuser it gives me below error as

 

$ pwd
/newuser
$ . .oraenv
sh: .oraenv:  not found.
$

 

Please advice.

 

Thanks & Regards

Raoof
Regular Advisor

Re: Create user

I copied env files from oracle home location i.e. /u01/oracle/ .oraenv .asmenv to neuser's location /newuser and when i tried to run it gives the below error.

 

$ pwd
/newuser

$ ls

.oranv  .asmenv
$ . .oraenv
sh: .oraenv:  not found.
$

 

Please advice.

 

Regards

Dennis Handly
Acclaimed Contributor

Re: Create user

>And in /etc/group: dba::2001:oracle,newuser

 

Hmm, that may not have been needed.


>But when I tried to run env file's from the newuser home directory it gives me below error as
sh: .oraenv:  not found.

 

You would need to copy (or symlink) those scripts to your new home directory.

 

>I copied env files from oracle home location to neuser's location and when I tried to run it gives the below error.

>. .oraenv
sh: .oraenv:  not found.

 

What is $PATH set to?  ($PATH is required for sourcing too.)

Try: . ./.oraenv

Raoof
Regular Advisor

Re: Create user

 

Please find below the details of envi file's..

 

/u01/oracle
$ vi .oraenv
".oraenv" 14 lines, 442 characters
ORACLE_BASE=/u01/oracle/11.1.0 export ORACLE_BASE
ORACLE_HOME=/u01/oracle/11.1.0/product/db_1 export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$PATH:$ORACLE_BASE export PATH
ORACLE_SID=mcmsdb1 export ORACLE_SID
NLS_LAN=AMERICAN_AMERICA.AR8MSWIN1256
export NLS_LANG
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH
CLASS_PATH=$ORACLE_HOME/jlib
export CLASS_PATH
CRS_HOME=/u01/app/11.1.0/crs
export CRS_HOME
PATH=$CRS_HOME/bin:$PATH
export PATH

 


###############

$ vi .asmenv
".asmenv" 16 lines, 376 characters
ORACLE_HOME=/u01/oracle/11.1.0/product/asm
export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$PATH
export PATH
ORACLE_SID=+ASM1
export ORACLE_SID
NLS_LAN=AMERICAN_AMERICA.AR8MSWIN1256
export NLS_LANG
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH
CLASS_PATH=$ORACLE_HOME/jlib
export CLASS_PATH
CRS_HOME=/u01/app/11.1.0/crs
export CRS_HOME
PATH=$CRS_HOME/bin:$PATH
export PATH

 

When i tried with the below cammond it works, but coudl you please tell me why i cannot go with only single dot instead of . ./.oraenv?

 

 . ./.oraenv

 

 

Regards

Dennis Handly
Acclaimed Contributor

Re: Create user

>could you please tell me why I cannot go with only single dot instead of . ./.oraenv?

 I told you already: What is $PATH set to?  ($PATH is required for sourcing too.)

 

You must have a "." somewhere in one of your $PATH components:  a-path:.:another-path

Or better yet, you must have the absolute path of those two env files in $PATH.

Raoof
Regular Advisor

Re: Create user

 

>> I told you already: What is $PATH set to?  ($PATH is required for sourcing too.)

 

Hope the PATH from the below envi file's is what you talking about? please correct me if am wrong.


$ vi .oraenv
".oraenv" 14 lines, 442 characters
ORACLE_BASE=/u01/oracle/11.1.0 export ORACLE_BASE
ORACLE_HOME=/u01/oracle/11.1.0/product/db_1 export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$PATH:$ORACLE_BASE export PATH
ORACLE_SID=mcmsdb1 export ORACLE_SID
NLS_LAN=AMERICAN_AMERICA.AR8MSWIN1256
export NLS_LANG
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH
CLASS_PATH=$ORACLE_HOME/jlib
export CLASS_PATH
CRS_HOME=/u01/app/11.1.0/crs
export CRS_HOME
PATH=$CRS_HOME/bin:$PATH
export PATH

 


###############

$ vi .asmenv
".asmenv" 16 lines, 376 characters
ORACLE_HOME=/u01/oracle/11.1.0/product/asm
export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$PATH
export PATH
ORACLE_SID=+ASM1
export ORACLE_SID
NLS_LAN=AMERICAN_AMERICA.AR8MSWIN1256
export NLS_LANG
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH
CLASS_PATH=$ORACLE_HOME/jlib
export CLASS_PATH
CRS_HOME=/u01/app/11.1.0/crs
export CRS_HOME
PATH=$CRS_HOME/bin:$PATH
export PATH

 

>>You must have a "." somewhere in one of your $PATH components:  a-path:.:another-path

Or better yet, you must have the absolute path of those two env files in $PATH.

 

Sorry i didn't get you from you above statements sorry.

 

Regards

 

 

 

 

Dennis Handly
Acclaimed Contributor

Re: Create user

>Hope the PATH from the below env files is what you talking about?

 

No.  You can't use the $PATH variable from inside the file you are trying to source.  :-)

You need to set it in your ~/.profile.

 

>>You must have a "." somewhere in one of your $PATH components:  a-path:.:another-path
>>you must have the absolute path of those two env files in $PATH.

>Sorry I didn't get you from your above statements.

 

How many times are you sourcing these two files?  If only once, then just use an absolute or relative path.

Otherwise you'll need to put the directory containing those two files in your $PATH settings.