Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have sample.sh script in /u01/dump location. I'm running it from root.

My requirement is while running the sample.sh script it has to be login as oracle1 user using SU (super user) and display all files in /u02/dba/ directory.

share|improve this question

2 Answers 2

So I suggest using:

su -l oracle1

share|improve this answer

It may be dirty hack but it will work :)

Modify /etc/passwd file by replacing /bin/sh tag of oracle1 user to ls and it's home directory to /u02/dba Also use su -l oracle1 in your sample.sh script.

So that, whenever you run script, the point where you changing user, it will show list of it's home directory.

share|improve this answer
    
I liked that actually.. love those dirty hacks when they work :D –  amyassin Oct 5 '12 at 9:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.