Home Man
Search
Today's Posts
Register

Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

One user to su to another without allowing root access and password

Tags
advanced

Login to Reply

 
Thread Tools Search this Thread
# 1  
Old 04-10-2017
One user to su to another without allowing root access and password

Hello Gurus,
I want One user to su to another without allowing root access and password.
I want to run a specific command as below from user am663:
---------------------------------------------------------
Code:
sudo -u appsprj4 /home/appsrj4/scripts/start_apache.sh

-------------------
But everytime I am facing the below error
Code:
[sudo] password for am663:
sudo: /home/appsrj4/scripts/stop_oacore.sh: command not found

----------
Below is the entry from /etc/sudoers file:
------------------------
Code:
am663   ALL=(appsprj4)          NOPASSWD: /home/appsprj4/scripts/start_apache.sh
am663   ALL=(appsprj4)          NOPASSWD: /home/appsprj4/scripts/stop_apache.sh
am663   ALL=(appsprj4)          NOPASSWD: /home/appsprj4/scripts/start_oacore.sh
am663   ALL=(appsprj4)          NOPASSWD: /home/appsprj4/scripts/stop_oacore.sh
am663   ALL=(appsprj4)          NOPASSWD: /u03/oracle/EBSDEV/fs1/inst/apps/EBSDEV_emaprjebs01/admin/scripts/adapcctl.sh
am663   ALL=(appsprj4)          NOPASSWD: /u03/oracle/EBSDEV/fs1/inst/apps/EBSDEV_emaprjebs01/admin/scripts/admanagedsrvctl.sh

Please advice on this.

Thanks-
Pokhraj
Moderator's Comments:
One user to su to another without allowing root access and password Please use CODE tags (not HTML and ICODE tags) for full line and multi-line sample input, sample output, and code segments.

Last edited by Don Cragun; 04-10-2017 at 09:04 AM.. Reason: Change HTML and ICODE tags to CODE tags; add ICODE tags.
# 2  
Old 04-10-2017
Code:
sudo -u appsprj4 /home/appsprj4/scripts/start_apache.sh

Note the missing red letter p.
# 3  
Old 04-12-2017
Awesome.. Thank you very much...

Thanks
Pokhraj
# 4  
Old 04-18-2017
Hello Gurus,
I am having one more issue while running the command.
HTML Code:
sudo -u appstst1 /stage/scripts/git_Code.ksh
When I am running the above command from user am663 all the files are downloaded as below:
HTML Code:
drwxr-xr-x 2 appstst1 oinstall 4096 Apr 18 13:00 FIN_EXT_004
drwxr-xr-x 2 appstst1 oinstall 4096 Apr 18 13:00 FIN_EXT_003
Now when I am trying to change the ownership to oemuser I am facing error as
Quote:
Operation not permitted
HTML Code:
oemuser:oinstall
Is there is any extra configuration I need to add at /etc/sudoers file?

Please advice

Thanks-
Pokhraj Das
# 5  
Old 04-18-2017
An application running as user appstst1 creates files belonging to appstst1, yes.

If the files are not overly large, you can get around this by making copies of the files(which will belong to you) then deleting the originals(you can delete any file in a writable folder you own).
# 6  
Old 04-18-2017
Hello ,
Can you please elaborate the concepts please..

Thanks-
Pokhraj Das
# 7  
Old 04-18-2017
A non-root user cannot change the ownership of someones else's file. One way to solve this problem is to have both users be a member of the same group and allow group access to the files. Since you are using the group oinstall now, you may want to create a separate group for this.

Set the primary group for the account that is executing the download (appstst1 in this case) to that new group so that the files are created with that group ownership. If you want the secondary user to also be able to delete/rename/etc these files then you should also set the umask in the script prior to performing the download

Code:
umask 007

This will set permissions on new files/directories created during that session to 770.
Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Non root user access to /dev/mem Soumyadip Dutta UNIX for Advanced & Expert Users 13 08-09-2018 07:01 AM
Root access that can't change root password? 244an Ubuntu 2 12-16-2013 06:24 AM
How to give root access to non root user? adisky123 Shell Programming and Scripting 4 04-30-2013 04:09 PM
How to allow access to some commands having root privleges to be run bu non root user suryashikha UNIX for Dummies Questions & Answers 5 10-30-2009 05:46 AM
access user history as root sardare Shell Programming and Scripting 4 07-01-2009 12:09 PM
I can not access root user through LAN rizwan225 Solaris 6 03-18-2009 06:03 PM
Change other account password from root access rakeshou UNIX for Dummies Questions & Answers 4 11-30-2007 10:06 AM
user commands without root access emealogistics HP-UX 1 05-26-2007 11:04 PM
how to access root priveliges if root password is lost wojtyla Linux 1 02-18-2005 05:24 AM
Allowing access to ports < 1024 w/o root rpollard Security 2 05-09-2002 11:23 AM


All times are GMT -4. The time now is 05:56 AM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password