Use "sudo" Command without password Prompt

Sometimes you need to run Linux command without password prompt using sudo command.

to learn more about this command read the link here.

For Example i need to run the following command without password prompt, However there are three sudo commands I want to run without entering password:

  • sudo reboot
  • sudo shutdown -r now
  • sudo shutdown -P now
to do this follow the below steps :-
  • edit the following /etc/sudoers file.
  • you find the following lines depend on the username and hostname for the server.

user host = (root) NOPASSWD: /sbin/shutdown
user host = (root) NOPASSWD: /sbin/reboot

This will allow the user user to run the desired commands on host without entering a password. All other sudoed commands will still require a password.

Notes:

  • Always use the command visudo to edit the sudoers file to make sure you do not lock yourself out of the system for example 

sudo visudo -f /etc/sudoers.d/shutdown

  • Using /etc/sudoers.d instead of modifying /etc/sudoers, you could add the two lines to a new file in /etc/sudoers.d for example  /etc/sudoers.d/shutdown.
  • If you did not use visudo to edit your files and then accidentally messed up /etc/sudoers or messed up a file in /etc/sudoers.d then you will be locked out of sudo.to fix it use command pkexec.
Cheers
Osama Mustafa

Change Enterprise manager password for 11g

For the DB Control Release 11.2 and higher, you need to set the environment variable ORACLE_UNQNAME to the value of the DB_UNIQUE_NAME database parameter.

Steps :

1.Stop the DB Control
On Unix
$ emctl stop dbconsole

On Windows
Open a Command Window and type
**> emctl stop dbconsole

2.Check that the DB Control is stopped
 On Unix
$ emctl status dbconsole
 

On Windows
Open a Command Window and type
 **>emctl status dbconsole

3.Connect to the database as a user with DBA privilege with SQL*Plus and execute:

SQL> alter user sysman identified by ;
 
4.Check the new password
SQL> connect sysman/[@database_alias]
 
5.From the database directory $ORACLE_HOME/bin, execute:
On Unix

$ emctl setpasswd dbconsole
Provide the new SYSMAN password
 
On Windows

**>: emctl setpasswd dbconsoleProvide the new SYSMAN password
 
6.Restart the DB Control
On Unix
$ emctl start dbconsole
 
On Windows
Open a DOS Command Window and type
**>: emctl start dbconsole
 

Thank you 

Osama Mustafa

Change Oracle Enterprise Manager 10g Password

How to change the password of the Database User SYSMAN when the database is hosting a DB Control Repository. 

1.Stop the DB Control
On Unix
$ emctl stop dbconsole

On Windows
Open a Command Window and type
**> emctl stop dbconsole

2.Check that the DB Control is stopped
On Unix

$ emctl status dbconsole

On Windows
Open a DOS Command Window and type
**> emctl status dbconsole


3.Connect to the database as a user with DBA privilege with SQL*Plus and execute:

SQL> alter user sysman identified by ;

4.Check the new password 

SQL> connect sysman/[@database_alias]
 

5.Go to $ORACLE_HOME/host_sid/sysman/config do the following :

    1. Save the file emoms.properties to emoms.properties.orig
    2. Edit the file emoms.properties
      1. Search for the line beginning with:
        oracle.sysman.eml.mntr.emdRepPwd=
        Replace the encrypted value by the new password value
        Example:
        oracle.sysman.eml.mntr.emdRepPwd=rainbow
      2. Search for the line:
        oracle.sysman.eml.mntr.emdRepPwdEncrypted=TRUE
        Replace TRUE by FALSE

6.Restart the DB Control
On Unix

$ emctl start dbconsole
 
Open a DOS Command Window and type
**> emctl start dbconsole
 
 
7.Check that the password has been encrypted
  1. Edit the file $ORACLE_HOME/host_sid/sysman/config/emoms.properties
    1. Search for the line beginning with:
      oracle.sysman.eml.mntr.emdRepPwd=
      Check that the password is encrypted
    2. Search for the line beginning with:
      oracle.sysman.eml.mntr.emdRepPwdEncrypted=
      Check that the value is TRUE

I Publish the same lesson but on 11g .

  Thank you 
Osama mustafa  

 

Change Oracle EnterPrise manager

DBA who never heard in this product from oracle ?

Some times for security issue we need to change the password , but as we all know nothing goes easy but all you have to do follow the below steps :

Stop Oracle Enterprise Manager
emctl stop dbconsole
emctl status dbconsole
Connect to database as sysdba and change system password
sqlplus / as sysdba

alter user sys identified by NewPassword ;
alter user system identified by NewPassword ;
alter user dbsnmp identified by NewPassword ;
alter user sysman identified by NewPassword ;

after this
emctl set password
and put your newpassword
restart your enterprise maybe you will not need to the below steps .

cd $ORACLE_HOME/sysman/config/emoms.properties :
oracle.sysman.eml.mntr.emdRepUser=SYSMAN
oracle.sysman.eml.mntr.emdRepPwd=d0355495a68cd5ae
oracle.sysman.eml.mntr.emdRepPwdEncrypted=TRUE
TO
oracle.sysman.eml.mntr.emdRepUser=SYSMAN
oracle.sysman.eml.mntr.emdRepPwd=Newpassword
oracle.sysman.eml.mntr.emdRepPwdEncrypted=FALSE
“in some database version you will not see all the parameters change what you have”

Thank you all .