Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save libin/1c6c2c88c159fa0f9c716aef0918b962 to your computer and use it in GitHub Desktop.
Save libin/1c6c2c88c159fa0f9c716aef0918b962 to your computer and use it in GitHub Desktop.

Revisions

  1. @sebsto sebsto revised this gist May 4, 2021. 1 changed file with 12 additions and 1 deletion.
    13 changes: 12 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -39,7 +39,8 @@ ssh -L 5900:localhost:5900 -C -N -i <your private key.pem> ec2-user@<your public
    open vnc://localhost

    #
    # On the mac, resize the APFS container to match EBS volume size
    # On the mac EC2 instance, resize the APFS container to match EBS volume size
    # https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-mac-instances.html#mac-instance-increase-volume
    #

    PDISK=$(diskutil list physical external | head -n1 | cut -d" " -f1)
    @@ -48,6 +49,16 @@ sudo diskutil repairDisk $PDISK
    # Accept the prompt with "y", then paste this command
    sudo diskutil apfs resizeContainer $APFSCONT 0

    #
    # (optional) On the mac EC2 Instance, set screen resolution
    # https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-mac-instances.html#mac-screen-resolution
    #
    brew tap jakehilborn/jakehilborn && brew install displayplacer
    displayplacer list
    displayplacer "id:<screenID> res:<width>x<height> origin:(0,0) degree:0"
    RES="2560x1600"
    displayplacer "id:69784AF1-CD7D-B79B-E5D4-60D937407F68 res:${RES} scaling:off origin:(0,0) degree:0"




  2. @sebsto sebsto revised this gist Dec 3, 2020. 1 changed file with 2 additions and 5 deletions.
    7 changes: 2 additions & 5 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -14,19 +14,16 @@ ssh -i <your private key.pem> ec2-user@<your public ip address>

    sudo passwd ec2-user

    # Enable VNC Server
    # Enable VNC Server (thanks [email protected] for the feedback and tests)

    sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart \
    -activate -configure -access -on \
    -configure -allowAccessFor -specifiedUsers \
    -configure -users ec2-user \
    -configure -restart -agent -privs -all

    # some folks reported that this line is required too (I am investigtaing)
    sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart \
    -activate -configure -access -on \
    -configure -allowAccessFor -allUsers \
    -configure -restart -agent -privs -all
    -configure -access -on -privs -all -users ec2-user

    exit

  3. @sebsto sebsto revised this gist Dec 3, 2020. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -22,6 +22,12 @@ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resourc
    -configure -users ec2-user \
    -configure -restart -agent -privs -all

    # some folks reported that this line is required too (I am investigtaing)
    sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart \
    -activate -configure -access -on \
    -configure -allowAccessFor -allUsers \
    -configure -restart -agent -privs -all

    exit

    #
  4. @sebsto sebsto revised this gist Dec 2, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -29,7 +29,7 @@ exit
    # Create a SSH tunnel to VNC and connect from a vnc client using user ec2-user and the password you defined.
    #

    ssh -L 5900:localhost:5900 -C -N i <your private key.pem> ec2-user@<your public ip address>
    ssh -L 5900:localhost:5900 -C -N -i <your private key.pem> ec2-user@<your public ip address>

    # open another terminal

  5. @sebsto sebsto revised this gist Dec 1, 2020. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,6 @@
    # YouTube (english) : https://www.youtube.com/watch?v=FtU2_bBfSgM
    # YouTube (french) : https://www.youtube.com/watch?v=VjnaVBnERDU

    #
    # On your laptop, connect to the Mac instance with SSH (similar to Linux instances)
    #
  6. @sebsto sebsto revised this gist Dec 1, 2020. 1 changed file with 13 additions and 0 deletions.
    13 changes: 13 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -32,5 +32,18 @@ ssh -L 5900:localhost:5900 -C -N i <your private key.pem> ec2-user@<your public

    open vnc://localhost

    #
    # On the mac, resize the APFS container to match EBS volume size
    #

    PDISK=$(diskutil list physical external | head -n1 | cut -d" " -f1)
    APFSCONT=$(diskutil list physical external | grep "Apple_APFS" | tr -s " " | cut -d" " -f8)
    sudo diskutil repairDisk $PDISK
    # Accept the prompt with "y", then paste this command
    sudo diskutil apfs resizeContainer $APFSCONT 0






  7. @sebsto sebsto revised this gist Dec 1, 2020. 1 changed file with 23 additions and 0 deletions.
    23 changes: 23 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,12 @@
    #
    # On your laptop, connect to the Mac instance with SSH (similar to Linux instances)
    #
    ssh -i <your private key.pem> ec2-user@<your public ip address>

    #
    # On the Mac
    #

    # Set a password for ec2-user

    sudo passwd ec2-user
    @@ -9,5 +18,19 @@ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resourc
    -configure -allowAccessFor -specifiedUsers \
    -configure -users ec2-user \
    -configure -restart -agent -privs -all

    exit

    #
    # On your laptop
    # Create a SSH tunnel to VNC and connect from a vnc client using user ec2-user and the password you defined.
    #

    ssh -L 5900:localhost:5900 -C -N i <your private key.pem> ec2-user@<your public ip address>

    # open another terminal

    open vnc://localhost



  8. @sebsto sebsto revised this gist Dec 1, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ sudo passwd ec2-user
    sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart \
    -activate -configure -access -on \
    -configure -allowAccessFor -specifiedUsers \
    -configure -users ec2-users \
    -configure -users ec2-user \
    -configure -restart -agent -privs -all


  9. @sebsto sebsto revised this gist Dec 1, 2020. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -4,9 +4,10 @@ sudo passwd ec2-user

    # Enable VNC Server

    sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart \
    -activate -configure -access -on \
    -configure -allowAccessFor -allUsers \
    -configure -restart -agent -privs -all
    sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart \
    -activate -configure -access -on \
    -configure -allowAccessFor -specifiedUsers \
    -configure -users ec2-users \
    -configure -restart -agent -privs -all


  10. @sebsto sebsto created this gist Dec 1, 2020.
    12 changes: 12 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    # Set a password for ec2-user

    sudo passwd ec2-user

    # Enable VNC Server

    sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart \
    -activate -configure -access -on \
    -configure -allowAccessFor -allUsers \
    -configure -restart -agent -privs -all