Desktop productivity for business analysts and programmers

File permissions for created files

Reply
Frequent Contributor
Posts: 148

File permissions for created files

When I use EG and save .sas program files or SAS data sets the default permissions created for them is 644 which means that other folks in the same group don't have write access. Is it possible to configure EG so files it creates use 664 instead?

We've tried updating the user profiles to set a umask to allow this, but it appears that EG is ignoring that.

Thanks,
Don Henderson
Valued Guide
Posts: 2,111

Re: File permissions for created files

EGuide must run on Windows, but your comments make it look like the files are being stored in a Unix environment of some sort. You probably need to work with your unix admin on how the unix-to-pc connection is made (Samba, NFS ?).
Frequent Contributor
Posts: 148

Re: File permissions for created files

Yes, EG is running on Windows - as part of an EBI environment where all the SAS data files and code are to be saved on the Unix server. The Unix admin has set things up so the default umask is 664. I have confirmed that works for a number of applications. But EG seems to not be using the default umask. So my question is how I tell EG to honor the profile information set for the user on Unix.
Community Manager
Posts: 2,697

Re: File permissions for created files

Don,

EG is using the IOM FileService to write the files into the UNIX server file system. So it's the SAS process running on UNIX that is writing the file. I guess I'd expect it to behave similar to writing a file you reference with a SAS fileref in a SAS program.

We can look into how that behavior is affecting the umask. I suggest working with tech support to help track the details.

Chris
Frequent Contributor
Posts: 148

Re: File permissions for created files

Wanted to close the loop with the solution provided by TS:
===============
The Unix file permissions of files created via an Enterprise Guide session are inherited from the userid that starts the Object Spawner process. If you'd like to alter the file permissions for EG users that launch workspace server processes you'll need to add a umask command to the WorkspaceServer script, WorkspaceServer.sh. This script is located in your configuration directory at:
//Lev1/SASApp/WorkspaceServer

In your case you would add umask 113 to the script somewhere prior to the the following line:
cmd="$SAS_COMMAND...

Save the WorkspaceServer.sh script and restart the Object Spawner and any existing EG sessions.
===============
Assuming TS says OK, I will likely post this as a Tip of the Day on sasCommunity.org
N/A
Posts: 0

Re: File permissions for created files

I also see this note on SAS support site that will make umask value effective for all workspace sessions but what would be the solution when users need flexibility i.,e save files as 664 or 644 as required through EG? Is there any way to run Unix commands like chmod through EG as they are not unix savy ?
Community Manager
Posts: 2,697

Re: File permissions for created files

Another option in SAS 9.2 to inherit the correct default umask:

Add the lines:

# Source Profile
~/.profile

in the file workspaceserver.sh. This is located in the config directory Lev1/SASApp/WorkSpaceServer.

Chris
Occasional Contributor
Posts: 6

Re: File permissions for created files

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);
Ask a Question
Discussion stats
  • 7 replies
  • 3841 views
  • 1 like
  • 5 in conversation