Jump to content
Sign in to follow this  
dummzeuch

suggestion for server side command execution on Linux

Recommended Posts

I have got a need to execute some simple Perl scripts on a Ubuntu Linux server on the LAN (no Internet involved).

So far, I am executing them via Putty in an ssh session that shows a small menu written in Perl. But that's cumbersome and I would prefer to have a Delphi client that requests a service to execute them.

As these commands require root privileges (*1) security is a big deal, so at least https and basic authentication should be used.

 

I could probably install Apache or a different web server and execute these commands via cgi, but this feels way overblown.

Some kind of REST API is what I am looking for, but I don't have any experience with the server side of that.

 

Any suggestions?

 

Just in case anybody wants to suggest that: We don't have a Delph license that allows writing Linux programs.

 

(*1: It's about creating zfs datasets and snapshots and changing their mount points.)

Share this post


Link to post

There is an add-on in Cockpit for ZFS Storage.
In the cockpit, you log in with the corresponding Linux user

Share this post


Link to post
1 hour ago, tgbs said:

There is an add-on in Cockpit for ZFS Storage.
In the cockpit, you log in with the corresponding Linux user

Sorry, my fault for not asking properly: I am not looking for a tool to replace Putty + the menu or the Linux shell, I am looking for a tool that allows a Delphi program to initiate starting those scripts, e.g. via a REST service.

Edited by dummzeuch

Share this post


Link to post

You can write your extension (script) to a Cockpit and then perform remotely. Extensions can be written on JavaScript. Can be called through something like this
curl -u 'Username: Password' -x Post \
 -d '{"Script": "/Path/to/your-script.sh", "args": ["arg1", "arg2"]}' \
 https: // <Server-IP>: 9090/My-Scripts/Execute
I think there was also a ready -made feature to access Shell, but I don't remember what it is. Since curl can be used, I see no reason for not writing the Delphi program. There are documentation for existing and new extensions.

 

Edit: A program can be written that performs something like this
ssh user@Server-IP> 'sudo myscript.sh'
The user must have sudo rights and be able to enforce it without a password. This is configured on the server. I think there are a lot of SSH access libraries with keys, not password

 

Edited by tgbs

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×