Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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


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.