Desktop productivity for business analysts and programmers

File permissions for created files

Reply
Regular Contributor
Posts: 167

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
Trusted Advisor
Posts: 2,121

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 ?).
Regular Contributor
Posts: 167

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: 3,344

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
Regular Contributor
Posts: 167

Re: File permissions for created files

Posted in reply to ChrisHemedinger
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: 3,344

Re: File permissions for created files

Posted in reply to deleted_user
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
Contributor
Posts: 28

Re: File permissions for created files

Posted in reply to ChrisHemedinger

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);
Contributor
Posts: 52

Re: File permissions for created files

Hi ,
Even i run the umask on linux (invoking a sas session). It does not work. It always takes the default permission 664. What is the best way to set the file permission as 755 .
read write execute for owner
read and execute for group and others.

Here is the code that i ran via putty (linux).
filename in "/export/home/xxxxxx/test.txt";
x "cd /export/home/xxxxxx/";
x "umask 001";
data add;
infile in dsd;
length city $10;
input name $ age city $;
file sysout2;
put _infile_;
run;
30?
NOTE: The infile IN is:
Filename=/export/home/xxxxx/test.txt,
Owner Name=xxxxx,Group Name=xxxxxx,
Access Permission=-rw-r--r--,
Last Modified=01Feb2018:14:36:15,
File Size (bytes)=58

NOTE: The file SYSOUT2 is:
Filename=/home/xxxx/sysout2.dat,
Owner Name=xxxxxx,Group Name=xxxxxx,
Access Permission=-rw-rw-r--,
Last Modified=13Feb2018:16:09:14
Ask a Question
Discussion stats
  • 8 replies
  • 5710 views
  • 1 like
  • 6 in conversation