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
  • #41792

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



    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)


    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.



    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.






    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


    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


    /etc/NX/nxserver –configupdate

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

    exit 0



    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/
    sudo chmod 755 /usr/NX/scripts/custom/

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

    UserScriptBeforeLogin "/usr/NX/scripts/custom/"


    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.