LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-31-2020, 02:03 PM   #1
aryacool
LQ Newbie
 
Registered: Jul 2013
Posts: 7

Rep: Reputation: Disabled
Smile prompting for password su - oracle -c “uptime”


trying to do some automation but when running the command its asking for password .

[non-root-user@XXXXXXXX ~]$ su - oracle -c "uptime"
Password:
or
[non-root-user@XXXXXXXX ~]$ sudo su - oracle -c "uptime"
[sudo] password for non-root-user:

what changes required that it should not go for password
 
Old 07-31-2020, 02:58 PM   #2
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.8.2003
Posts: 4,960

Rep: Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830
Not sure you'd want to be able to login to the oracle user without a password...I wouldn't.
But, why do you want to be oracle to run uptime? Any user should be able to run that command.
...and what are you trying to automate? If you're using cron, you should be able to run uptime from the oracle user's crontab.
 
Old 07-31-2020, 03:50 PM   #3
aryacool
LQ Newbie
 
Registered: Jul 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
i have given one of example , i will place script in that place which will run from oracle user side .
 
Old 07-31-2020, 03:53 PM   #4
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.8.2003
Posts: 4,960

Rep: Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830
Quote:
Originally Posted by aryacool View Post
i have given one of example , i will place script in that place which will run from oracle user side .
So that solves the problem? You're going to use the oracle user's crontab?
You can use the Thread Tools to mark the thread [SOLVED].
 
Old 07-31-2020, 04:07 PM   #5
aryacool
LQ Newbie
 
Registered: Jul 2013
Posts: 7

Original Poster
Rep: Reputation: Disabled
no its not resolved , i want to run from the user which is non oracle user but yes that user has sudo to oracle privilege. still its prompting for password as i posted in 1st post.

Thnx
Arya
 
Old 07-31-2020, 04:59 PM   #6
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.8.2003
Posts: 4,960

Rep: Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830Reputation: 1830
Quote:
Originally Posted by aryacool View Post
no its not resolved , i want to run from the user which is non oracle user but yes that user has sudo to oracle privilege. still its prompting for password as i posted in 1st post.

Thnx
Arya
OK. We'll need to wait for someone who uses sudo. I believe that's possible, but 1. I don't use sudo and 2. I don't mind typing passwords. You could start with the SUDO.CONF(5) man page.
 
Old 08-01-2020, 03:08 AM   #7
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 1,423

Rep: Reputation: 637Reputation: 637Reputation: 637Reputation: 637Reputation: 637Reputation: 637
AFAIK you put the following rule in a new file /etc/sudoers.d/oracle.conf
(Or add to the /etc/sudoers file if /etc/sudoers.d/ fragments are not supported.)
Code:
ALL ALL=(ALL) NOPASSWD: /usr/bin/su - oracle *
that allows for ALL users
Code:
sudo su - oracle -c command
Or put the following rule:
Code:
ALL ALL=(oracle) NOPASSWD: ALL
that allows for ALL users
Code:
sudo -u oracle command
The -u option switches to the following user (oracle, instead of root). Consult
Code:
man sudo
for further options.
 
Old 08-01-2020, 04:33 AM   #8
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 14,976
Blog Entries: 9

Rep: Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240Reputation: 4240
^ wouldn't it be safer to allow oracle to run only that one command without password?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
init uptime longer than system uptime? m4rtin Linux - Server 1 09-15-2010 07:45 AM
SWAT is prompting for a username/password jdklein1975 Linux - Newbie 2 07-23-2008 05:08 PM
Samba share keeps prompting for password debaire Linux - Enterprise 1 12-18-2004 07:08 AM
Prompting for a password with pppoe fcnewbie Mandriva 0 06-15-2004 01:36 PM
frequent password prompting jwhiz Linux - Newbie 3 12-27-2003 05:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration