Macro to change the permissions of SAS Dataset:
%macro chmod(libname,dataset,permis=777); proc sql; /* get the absolute path of the libname */ select path into: extpath from dictionary.members where libname="%UPCASE(&LIBNAME)"; /* find out if there are any datasets in the library */ select count(path) into: cnt from dictionary.members where libname="%UPCASE(&LIBNAME)"; /* if there are datasets...then issue the below command to change the permissions of the dataset called in this macro to 777 */ %if &cnt > 0 %then %do; filename chmod pipe "chmod &PERMIS %trim(&extpath)/&dataset..ssd01"; data _null_; file chmod; run; %end; %mend; /* assign a libref to test the macro */ libname link '/local/u/sssims/sasuser612'; /* test the macro on the 'houses' dataset in the 'link' library */ %chmod(link,houses);
Am I understanding this correctly in that if you change the profile in script reference above that it will change the permissions for all users of EG?
That is a problem in that we only want the permissions changed for specific users upon creating files - it seems like the default as one user noted is 644, we want 664 for selected users not everybody. We want each user to be able to control this in their .bashrc with umask.
Note that if I run code outside of EG (for example using XWindows program like Mobaxterm) directly on the Unix server, then it reads my umask.
Using chmod is impractical since we are creating many permanent files all the time.
Is there any other way - can individual users' umask be read by executing a script in EG code with a system command "X....."?
@larryrobert - Surely this would be easier and more reliable to implement via a special login profile for the SAS users that require it? I'm not familiar enough with Unix to suggest how to do this but a Unix administrator should be able to advise.
In the WorkspaceServer_usermods.sh file, you can set the umask conditionally for certain users. When the shell script runs, the switch to the logged-in (via metadata) user has already been made (from the user that is running the object spawner).
The umask that you experience per default is the one from the userid running the object spawner.
This fixed our issue, just added umask 007 as we needed rw-rw---- permission.Thank you so much.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.