create a file using sudo

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

create a file using sudo

Post by narasimha »

We have a secure location on our DataStage Server where I use the below approach to work with a file.

Code: Select all

sudo -u <user_thats_owns_the_location> touch <file_name>

I can do it directly on the OS, but I would want to write to this location using a simple job. Source_File -> Transformer -> Target_File

Any pointers?
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Can you use an External Target stage to write the file via a sudo command?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

I would want to implement this in existing server and parallel jobs.
Probably I should have been more clear/specific with my design, it is using sequential files (Majority of them are Server Jobs)

Source_Sequential_Stage -> Transformer -> Target_Sequential_File
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Then run your job as the user ID to which you change using sudo. For example

Code: Select all

sudo -u userID "$DSHOME/bin/dsjob -run -jobstatus $projectname $jobname"
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

I was thinking if there could be anything introduced in the "Filter Command" of the sequential file stage or something on that lines.
Looks like there is no option, but to invoke the job as a different user.

Thanks again
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
Post Reply