09-06-2023 07:44 PM
Hi all
Trying to change folder permissions through labview. The commands I am trying to run are:
[open terminal]
ssh admin@[ip address]
chown lvuser:ni /path/to/folder/i/want/to/alter
chmod 777 /path/to/folder/i/want/to/alter
So far I have tried a variety of suggestions ive found on this forum, including trying ' cmd /c ssh admin@[ip address] & chown lvuser:ni /path/to/folder/i/want/to/alter & chmod 777 /path/to/folder/i/want/to/alte ' but this doesnt seem to work either. Does anyone have suggestions on how to do this? This code is running on a windows machine, and SSH'ing into the RT to change folder permissions on it.
Thanks
09-06-2023 11:33 PM
First, does this command work if you actually SSH into the rt target (I suggest using Putty for that)?
Don't you need sudo to do a chosen?
Also if you apply to the folder, I don't think it applies to the folder's content so you might want to add arguments like * (to apply to existing files) and -R (to also include sub-folders)
You canaso use WinSCP, it offers a basic UI if you're not a command line fan
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
09-07-2023 02:21 AM
I'd try to make a .bat file and run that through system exec
09-07-2023 11:35 AM
Does this work?
ssh admin@host "chown lvuser:ni /path/to/folder/i/want/to/alter && chmod 777 /path/to/folder/i/want/to/alter"
I cannot try with a Linux machine, but this works with a Windows client to a Windows host and LabVIEW 2020 64 bit:
ssh User@host "mkdir test && mkdir test2"
You have to use '&&' to chain commands. Adding '&' will put execution in the backgound.
09-07-2023 12:15 PM
If you need to do this from a LabVIEW application running on Windows, you could use the command line version of Putty, call Plink.
Documentation:
https://the.earth.li/~sgtatham/putty/0.79/htmldoc/Chapter7.html#plink
Download page:
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
There are 32 and 64-bit versions, use the one that matches your LabVIEW bitness.
For sending multiple commands, try separating them using a semicolon " ; ".
09-07-2023 04:53 PM
Thanks for the replies all.
This needs to happen on either the RT or a computer linked to the RT.
This needs to happen programatically, so I cant have anyone access the computer since its remote, to run these commands. I wanted to do this on startup.
I posted a similar question here but didnt get far.