Forum / General Discussions / Manage clipboard behavior via login script
- This topic has 5 replies, 3 voices, and was last updated 1 year, 11 months ago by Britgirl.
-
AuthorPosts
-
December 2, 2022 at 18:41 #41792sdeglerParticipant
I want to modify cut + paste behavior based on the users’ IP address. Is that possible ?
December 6, 2022 at 10:54 #41842BritgirlKeymasterYes, 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)
December 6, 2022 at 19:42 #41854sdeglerParticipantI 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.
December 8, 2022 at 16:09 #41886sdeglerParticipantHere’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
December 13, 2022 at 16:32 #41985kroyContributorWe 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.shand uncomment and edit following key in /usr/NX/etc/server.cfg:
UserScriptBeforeLogin "/usr/NX/scripts/custom/UserScriptBeforeLogin.sh"
December 13, 2022 at 16:36 #41990BritgirlKeymastersdegler, check your email inbox for attachments from us.
-
AuthorPosts
This topic was marked as solved, you can't post.