I am able to mount a corporate shared directory on my AWS Workspace manually but I need to do this for all users.

$ sudo ksu
[sudo] password for <Domain>\<User.Name>: 
Leaving uid as root (0)
$ mount -t cifs //<Domain>/<Path> /home/*/<Mount\ Point\ Name> -o multiuser,sec=krb5
$ exit

I need this to work for all users which means I need a general solution.

Amazon Workspaces create one virtual machine per user. I need to create an image of my OS to share with other users. So even if I were in some way to create a fstab entry with my credentials, those credentials wouldn't be valid for any other user's Workspace.

I may have the wrong end of the stick, this may not be achievable.

I imagine something like the above, might work by creating a script that runs at user log-on, as the user which uses ksu to create the context and then mounts a directory in the user's home directory. Therefore the user's credentials wouldn't be available at run time as they'd be just logging in.


First to set out the store, so as to speak. The goal, mount a network share when the user logs into to the Workspace. The constraints: must use kerberos, don't know who the user is ahead of time, can't use any stored credentials.

The above is as far as I can see a blind alley.

So the solution that I'm using: pam_mount

Edit two files:

  1. /etc/pam.d/system-auth
  2. /etc/security/pam_mount.conf.xml

Editing the first file may be optional depending upon your distribution, add two lines:

auth        optional      pam_mount.so
session     optional      pam_mount.so

Try to follow the convention of your system-auth and add these lines to the appropriate sections.

Add the following to the second file:

<!-- Using CIFS -->

Update this part to reflect your needs.

For further information please review the source pages for the above:

TechRepublic - Using pam_mount to automount filesystems at login

Arch Wiki - pam_mount

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.