Skip to content

How do I map a network file share on a Linux WorkSpace?

3 minute read
-1

I want to mount a network file share on an Amazon WorkSpaces Linux WorkSpace.

Resolution

Mount an Amazon EFS file share on a Linux WorkSpace

To mount an Amazon Elastic File System (Amazon EFS) file system in a Linux WorkSpace, use the mount target's DNS Name or IP address from Workspace. Complete the following steps:

  1. Open the Amazon EFS console.
  2. In the navigation pane, choose File systems.
  3. Select the file system that's your mount target.
  4. In the Details pane, under Mount targets, copy the DNS Name or IP address.
  5. Configure the EFS file system security group to allow inbound traffic to TCP port 2049 from the abcxyz_workspacesMembers security group.
  6. To mount the EFS file system on the Linux WorkSpace, run the following command:
    sudo mount -t nfs EFS_FILE_SYSTEM_DNS_NAMEorIP_ADDRESS:/ /mnt/efs
    Note: Replace EFS_FILE_SYSTEM_DNS_NAMEorIP_ADDRESS with the DNS Name or IP address of your mount target. To mount EFS mount helper, you must first install the amazon-efs-utils package. However, this rpm-based package is available only in Amazon Linux releases. For other Linux distributions, you must compile packages from the source. For more information, see On other Linux distributions on the GitHub website.
  7. To verify that you successfully set up the network file share, run the following command:
    df -h
    Example output:
    EFS_FILE_SYSTEM_IP_ADDRESS (or) EFS_FILE_SYSTEM_DNS_NAME  /mnt/efs

Mount a Windows file share on a Linux WorkSpace

To mount a Windows file share on a Linux WorkSpace, complete the following steps:

  1. To install the cifs-utils package, run one of the following commands based on your distribution.
    Amazon Linux 2 WorkSpace:

    sudo yum install cifs-utils

    Ubuntu WorkSpace:

    sudo apt install cifs-utils 

    Red Hat Enterprise Linux WorkSpace:

    sudo dnf install cifs-utils
  2. To set up a directory on your Linux system as your mount point, run the following command:

    sudo mkdir -p /mnt/windows-share

    Note: Replace windows-share with your directory name.

  3. To authenticate with Kerberos, run the following command:

    kinit
  4. To mount the Windows file share, run the following mount.cifs command:

    sudo mount -t cifs //server/share /mnt/windows-share --verbose -o vers=3.0,cache=none,user=$USER,cruid=$USER,sec=krb5,uid=$(id -u),gid=$(id -g)

    Note: Replace the //server/share with the universal naming convention (UNC) path of your Windows file share.

  5. To verify that you successfully set up the network file share, run the following command:

    df -h

    To automatically mount the file share on system boot, add the mount command to your Linux system's /etc/fstab file. It's a best practice to automatically mount the file share if you need to access it frequently.

Related information

Mounting EFS file systems

How to access Amazon FSx for Windows File Server from a Linux client on the YouTube website

Mounting a file share on an Amazon Elastic Compute Cloud (Amazon EC2) Linux instance

AWS OFFICIALUpdated 4 months ago
1 Comment

Hello,

Why does this procedure suggest mounting using an IP address rather than the EFS DNS name? Are you trying to use a specific mount target in the same subnet/AZ as the WorkSpace or is there some other reason? (As I understand it the AWS .2 resolver will automatically resolve an EFS DNS name to a local IP for it, if available.)

It is worth calling out in this guide that WorkSpaces are unable to have IAM roles attached to them, unlike the EC2 option of using EC2 Instance Profiles. This is due to a limitation to the Amazon WorkSpaces service, as they are special EC2 instances which are AWS-managed but have a second ENI in the customer's VPC.

It's also worth noting that at the time of writing the amazon-efs-utils package which is needed for data transport encryption is only provided as an RPM compatible with Amazon Linux releases. If you're on another Linux OS you'll have to build it yourself.

replied 6 months ago