Page 1 of 1

create a file using sudo

Posted: Tue Nov 02, 2010 5:53 pm
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?

Posted: Wed Nov 03, 2010 12:29 am
by ray.wurlod
Can you use an External Target stage to write the file via a sudo command?

Posted: Wed Nov 03, 2010 10:13 am
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

Posted: Wed Nov 03, 2010 10:23 am
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"

Posted: Wed Nov 03, 2010 6:34 pm
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