I see this question has been asked but the context of that question is different and so there are no answers relavent to my use case so I'm asking a new question
I have an Electron based Web Server. It's meant for beginning web developers, students, and artists that are not used to the command line (yes that's a huge debate right there but I was scolded by the teachers at the Art and Design School at UCLA for asking their students to use the command line, hence a simple server with a GUI. Please don't debate this point. It's not the point of the question)
In any case, people using this web server sometimes want to run on port 80. On Mac (and Linux?) port 80 requires admin rights and so I'd like to escalate the server's permissions to do this.
My understanding is the easiest (only?) way to do this is to spawn another process. Since the server part of my web server is effectively written in node.js and since node.js (or at least the API) is built into Electron then it seems like the best solution would be to just re-spawn my Electron app to run only the server portion.
In other words, imagine I could run the app like
/Applications/Servez.app/Contents/MacOS/Servez --no-gui --server-only --port 80
Then I could use some spawn command on Mac like
/usr/bin/osascript -e '
do shell "/Applications/Servez.app/Contents/MacOS/Servez --no-gui --server-only --port 80" with administrator privileges
'
And macOS will ask for admin privileges before running the server.
If I can't run Electron with no GUI then I could include a copy of node.js inside the Electron package but it seems like a huge waste of space given the same functionality is already inside Electron. Or maybe there is some other solution? (some API call I can make to ask for permission to use port 80?)
Setting the environment variable ELECTRON_RUN_AS_NODE will run Electron as node so I can just set that environment variable when spawning Electron
Related
I am using google-cloud-shell which is basically a shell that allows us to use online cloud shell (for developing apps etc.) and provides 5gb of free storage (only for home directory).
It is a very cool thing because i don't have PC but google-cloud-shell allows me to run gradle, java, python, etc. without any issues except one issue and i.e typing response. Although it is a very good platform for learning coding but typing is insane.
If i type a character it takes about a second to be displayed on screen and it really really sucks. Now what i want is to connect this shell to termux (which is an app just like terminal in linux) with ssh or any other thing that can connect it.
NOTE: I am not using paid version of google-cloud-storage I am just using it cloud shell which is free to use.
You can use the following gcloud command to SSH into your cloud-shell from local terminal.
gcloud alpha cloud-shell ssh
You can find more details here
I am trying to connect to an SFTP server with my AIR application. It doesn't matter that it's an AIR application except that I haven't found any libraries or AIR API methods for it.
My first thought is to find a library in another language and rewrite it in ActionScript. I'd rather not do that and my lack of experience may introduce security issues.
My second thought is to call a native process or command such as sftp or sshpass or curl from my main application and pass the local and remote upload locations to it and let it do the work. The downside to this is if they don't have the command installed they have to install a separate program.
My questions are:
Are these SFTP commands available by default on both Mac and Windows?
Should I store the users login (I do not want to) or prompt them to enter it each time? Does SFTP / public key remove the need for that?
I've found two related questions here and here but some of it is over my head. They also seem to be specific to *nux (which may work for Mac as well but not Windows).
I do not have the experience in this area so I would welcome those with experience to give guidance if this is a good idea or not. Overview type answers are welcome for me as I can attempt to work out the details. If no answer is given, once I've figured it out I'll post an answer. Please do not close this question (rather suggest edits).
FYI I'm using AIR to make a native process call.
An AIR application in the extended desktop profile can execute a file,
as if it were invoked by the command line. It can communicate with the
standard streams of the native process. Standard streams include the
standard input stream (stdin), the output stream (stdout), the
standard error stream (stderr).
I can also create and call a scpt, sh or bat file.
Commands installed on my Mac:
curl_init(), curl_setopt()
ssh
sftp
Commands not installed on my Mac:
sshpass
Are these SFTP commands available by default on both Mac and Windows?
No. There is no sftp nor ssh on windows by default, unless you install it through cygwin or bundle them in your application (also solution).
Should I store the users login (I do not want to) or prompt them to enter it each time?
Prompt is preferred.
Does SFTP / public key remove the need for that?
Yes, but you will have to store private key, which is almost the same like storing password.
Is there a possibility to run AppleScripts from a server or from a cloud service?
I want to have some scripts that can run if my computer is sleeping/off.
I looked around a bit on Google, but haven't found anything promising.
If this doesn't exist I basically need to remove the password from my computer and wake up the computer whenever the script needs to run.
It largely depends on what you want to do with the script. There are a few options.
You can use 'stay open' script bundles that, for example, check a certain folder and run when you interact with this folder
You can launch certain scripts when the server boots.
You need to have a server that is always on for this to work. I have this running myself and it works just fine. However, as I said before, it largely depends on what you want to do with your scripts.
First, I guess I'd have to figure out if I'm running remotely and second I'd have to figure out whether my remote connection is a standalone remote app or an app running on a terminal server (that may be tricky).
But, once I've figured out all those awful things, is there a way to run a windows function like ShellExecute locally instead of remotely?
The reason I'd want to do this is because I launch a web browser to view rather high bandwidth things that require javascript and flash and certain sysadmins who administer our product aren't too keen on having to make unnecessary and insecure modifications to their terminal server farm.
Yes, if the clients are running Windows and you can install software on them.
See Remote Desktop Services Virtual Channels in MSDN.
There is a free tool that does exactly what you want. I got reference from TechNet forums, it's named Remote Executer from http://www.mqtechnologies.com
Good luck
I'm developing a program in windows (something like client & server) and I want to run server as LSA(local system account).but I don't know how?
Note: I'm writing my program in VB6 but I'm familiar with C#,C++ and C. So if your code is in any of these languages, I would be appreciate putting your code here.
There are a few options that come to mind. This article covers some of them.
Other things you could do is to add your app to the system startup process (via the MSCONFIG.exe app - "Start -> Run -> msconfig -> Startup" tab, or something like that).
Another way may be to setup your app so it can be installed as a service. You can configure any service to run under any arbitrary account on the machine, or via an account on your domain, if you're on a domain.
Another resource that looks like it might work for you is this article, which describes in more specifics, how to create a service from a VB6 app.