Manage clipboard behavior via login script

Forum / General Discussions / Manage clipboard behavior via login script

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #41792
    sdegler
    Participant

    I want to modify cut + paste behavior based on the users’ IP address.  Is that possible ?

     

    #41842
    Britgirl
    Keymaster

    Yes, using a combination of groups and profiles. You can block copy and paste in profiles for specific user groups.

    All NoMachine Enterprise server products support groups, so you can create your group and then set a redirect based on IP address for that group.

    --groupadd(there is also –-groupedit, --grouplist)
    `Create a NoMachine group and then add users to the group via the
    –useradd command. Use –redirect to set IP or hostname and port
    for the NoMachine server where connections run by users belonging
    to that group are forwarded.`

    Then, using profiles, you can disable features for your newly created groups.

    Profiles are available in the following products: Cloud Server and Enterprise Terminal Server. By creating rules on the Cloud Server (any of the Cloud Server range), you can propagate them to server nodes.

    See here for example: 4.5. Setting Profiles for the Nodes (Rules Propagation)

    https://kb.nomachine.com/DT08T00265#4.5

    #41854
    sdegler
    Participant

    I should have said I want to dynamically modify cut and paste for users.   When they go direct, they should have the equivalent of EnableClipboard both, but when they come in from a gateway, I want them to only have EnableClipboard client.

     

    #41886
    sdegler
    Participant

    Here’s what we came up with:

    1. we have a beforeuserlogin script that edits a template server.cfg and replaces server.cfg.
    2.  The script reloads the config after mofifying server.cfg.

    !/bin/bash

     

    ip=$1

    LOG=/tmp/nomachinebeforeloginscript.log

     

    if [ “$ip” = “X.Y.Z.A” ]; then     # this is our external gateway

    echo sed ‘s/#%EnableClipboard%/EnableClipboard client/’ >> $LOG

    sed  ‘s/#%EnableClipboard%/EnableClipboard client/’ < /usr/NX/etc/server.cfg.template > /usr/NX/etc/server.cfg 2>> $LOG

    echo “result code of sed is ‘$?'” >> $LOG

    else

    echo sed ‘s/#%EnableClipboard%/EnableClipboard both/’ >> $LOG

    sed ‘s/#%EnableClipboard%/EnableClipboard both/’ < /usr/NX/etc/server.cfg.template > /usr/NX/etc/server.cfg 2>> $LOG

    echo “result code of sed is ‘$?'” >> $LOG

    fi

    /etc/NX/nxserver –configupdate

    echo “result code of nxserver is ‘$?'” >> $LOG

    exit 0

     

    #41985
    kroy
    Contributor

    We modified a little your script. It works now as you planned. Just create folder:

    sudo mkdir -p /usr/NX/scripts/custom

    and place there script, set permissions:

    sudo chown nx:nx /usr/NX/scripts/custom/UserScriptBeforeLogin.sh
    sudo chmod 755 /usr/NX/scripts/custom/UserScriptBeforeLogin.sh

    and uncomment and edit following key in /usr/NX/etc/server.cfg:

    UserScriptBeforeLogin "/usr/NX/scripts/custom/UserScriptBeforeLogin.sh"

    #41990
    Britgirl
    Keymaster

    sdegler, check your email inbox for attachments from us.

Viewing 6 posts - 1 through 6 (of 6 total)

This topic was marked as solved, you can't post.