Users of SAS Studio and other SAS Viya programming clients are used to having their operating system home-directories available while they work. Gerry Nelson in his article SAS Viya: making user home directories available to compute My Personal Home Directory...
Michael Dixon
Managing Director
Michael is the original platform nerd (his words, not ours). He’s spent the past 30 years immersed in the world of SAS and enterprise analytics — breaking things, fixing them better, and helping organisations do far more with their data than they thought possible. As the founder of Selerity, he brings a rare blend of deep technical knowledge, commercial pragmatism, and a dry sense of humour to every client conversation.
Users of SAS Studio and other SAS Viya programming clients are used to having their operating system home-directories available while they work.
System Administrators have been dealing with this scenario for decades now, and established methods of making a personalised, secure home directory available to users now usually rely on NFS or CIFS/SMB.
Viya provides the ability to make home directories served by NFS available to applications that use the Programming Run-Time Servers (such as SAS Studio). You do this by specifying the NFS server details during deployment. If your NFS server and Identity Provider are already used to serve home directories to other applications then the documented defaults will work great – but what if that isn’t the case?
Behind the Scenes
Under the covers, Viya is running in a Linux environment (within containers, within Kubernetes). Each user in Linux is assigned a unique User ID (uid). This uid is what allows a user to access their own personal home directory, among other things. Viya on its own has no idea what uid is assigned to what user, unless that information is provided by the Identity Provider. If you are leveraging an existing NFS Server backed by an Identity Provider that is already in use with that NFS Server, then there is a good chance (but not guaranteed) that your Identity Provider already has the required posix attributes to provide the uid to Viya.
Active Directory
If you are using Active Directory as your Identity Provider then there is a good chance that you don’t have these attributes. In this case Viya will generate a uid (and Group ID, or gid) for each user and store it internally. This allows Viya to kick off compute sessions using the uid it has generated, but for obvious reasons nothing outside Viya knows about this uid – which means when it comes to accessing a user’s home directory on NFS, the uid will most likely not match the uid on the home directory.
Home Directories Solved?
But there is a problem even before we get to the matching uid problem – how does the system know it even needs to create a home directory on NFS for the user? In a traditional Linux environment this is taken care of by PAM, leveraging methods such as pam_mkhomedir. This in turn relies on the Identity Provider of the operating system. In fact this is what the earliest solution to this problem used. In Viya 3.4 a more integrated solution was provided directly in the deployment process, followed by further updates in Viya 3.5. Unfortunately starting with Viya 2020.x these methods no longer work.
This script works great, but the “how to” of getting it running and integrated into your Viya Kubernetes environment is left to the user.
Home Directory Solution from Selerity
To make implementing this a bit easier, Selerity have created a Helm Chart that will deploy a Cron Job into Kubernetes to maintain home directories in NFS using the uid internally generated by Viya.
To install this solution you should be familiar with Kubernetes and Helm, as well as have the details of the NFS Server used during your Viya Deployment. Here is all that is needed to get this deployed:
This will create a Kubernetes Cron Job that must be triggered manually, and when you do trigger it will only report on what it will do (it won’t create or update anything). This will let you view the logs to see what it would do if it was enabled. The parameters above are:
VIYA_NAMESPACE – the namespace you have deployed Viya to
RELEASE_NAME – any string you want to use as the name of this deployment
VIYA_BASE_URL – the URL to your Viya deployment
NFS_SERVER_NAME – the hostname/IP of the NFS Server you specified in your Viya deployment
After a successful install you will be presented with instructions on how to view/trigger/etc. the Cron Job. If you are happy that the process will work correctly in your environment (after reviewing the logs of a sample run) you can enable it to create/update home directories by adding the --set dry_run=0 option on the Helm command, and if you want to enable it to run on a schedule also add the --set suspend=false option. Further details are available in the Helm Chart.
Helm Chart on ArtifactHUB
viya4-home-dir-builder: Create home directories for SAS Viya 4 Users
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional
Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.