Solved: Need help getting a web page to start a server.
Wont let me add the solved tag, say's im over the max. Removing 2 tags did not help.
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
One of my game servers keeps going offline and so I want to give the users the ability to bring it back up.
The easiest way I could think of is to create a web page that would execute a bash
script. Here is the code I used.
My web page works and will execute the script but all it does is echo to the webpage.
I thought maybe it was because the web page user needs root access and I found a source that suggested adding the following to the sudoers file.
The problem is that when trying to use visudo from Webmin Command Shell I get this.
So how do I edit the sudoers file?
Am I on the right track?
Last edited by Stuperfied; 11-13-2018 at 01:21 AM..
Reason: Solved
Putting sudo scripts embedded in php code at user clicks is not advisable nor desirable.
It is a major security issue and should be treated like that.
Why not use existing tools, which have agents and API(s) at your disposal.
Include those in your project if you require such actions.
Restarts, deployments will be transparent to user, not dependent on application itself and fairly secure.
If you really need user interaction for such tasks, otherwise cron is fine, and best would be to see why application needs to be restarted
Location: Asia Pacific, Cyberspace, in the Dark Dystopia
Posts: 19,118
Thanks Given: 2,351
Thanked 3,359 Times in 1,878 Posts
Quote:
Originally Posted by Stuperfied
I did think of that but we are trying to make everything controlled by web interface and this is just one small part of a larger project yet to come.
Hmmm.
I used to think that way, but without really great serve-side sys admin skills you may be creating unnecessary security risks. Even guys like me with a decades of years experience on the server side, do not use the web to do superuser-required tasks. It just takes one mistake and you could lose your server and your data.
Yes, you can kludge solutions together which will work, but they will leave you vulnerable to major security risks.
I suggest you do this with a cron file, to insure your game servers are running, and move on to other tasks
Never, in the spirit of creating a "perfect solution" do things which leave your server vulnerable. After you have done 100 tasks and written 29999 lines of code, you will forget all the insecure code you wrote and you will have problems later on.
Why make problems for yourself when you can do the same thing in a more secure way which will not expose you to security risks?
best would be to see why application needs to be restarted
Amen!
If i have learned anything in the nearly fourty years i work in IT it is this: if there is a problem, DO NOT create a workaround - solve the problem instead! Workarounds may be implemented faster sometimes but they inadvertently come back to haunt you and most probably they bite you in the behind in the least convenient moment.
Instead of creating ways to faster restart the server find out why it needs to be restarted. Your description ("...one of our servers...") implies that it is just one server, not the other ones. So, where is the difference? What is special in this server so that it keeps crashing the application? Have you considered reinstalling it from scratch?
In your place i'd investigate this instead of finding ways to selectively poking holes into my server security.
I hope this helps.
bakunin
These 2 Users Gave Thanks to bakunin For This Post:
Dudes, this is a minecraft server. I dont really care about security, ive lost everything multiple times before due to hosting issues and I gotta tell you it wasn't the end of the world. The community adapted.
My issue now is that we are running the latest snapshot servers and they are really unstable. They shut down randomly because of updates or bugs and there is nothing I can do about that. Now my server managers really would like to be able to start / stop servers through a web app rather than having to login and go to cron jobs all the time. They already have RCon at their disposal but that doesn't help them start the servers after they have been stopped. Now a few simple buttons with start, stop, restart is probably not so much of a security risk and let them hack me if they want to waste their time cause there's no secure info kept on these servers.
Hi All,
I'm getting this below error
bash-4.1$ ./apachectl -k start
(98)Address already in use: make_sock: could not bind to address hostname:18000
no listening sockets available, shutting down
Unable to open logs
I tried to change the port number, still same error:
... (5 Replies)
Hi,
I have html page in my unix machine(server), which I will open with firefox or mozilla available in unix machine. Firefox or mozilla will be opened using x windows.
Since I have access to unix machien(like other users) and this HTML page is for user having access to Unix machine, I see no... (7 Replies)
Hello,
I have created a web page on a server using apache and added .htaccess and .htpasswd in the folder for authentification.
I was wondering if there was anyway to tie-in the login for this page with the login used to logon to the server.
i.e. the same login info. is used for both, when... (1 Reply)
Hello,
I have created a web page on a server using apache and added .htaccess and .htpasswd in the folder for authentification.
I was wondering if there was anyway to tie-in the login for this page with the login used to logon to the server.
i.e. the same login info. is used for both,... (2 Replies)
Hi all,
I am new to UNIX and so am struggling a bit on using the right commands.
I am working on a remote UNIX server and i need to load a web page using firefox. I can use the client IP address to access the web page but i am not able to do so because the command i am typing is wrong.
... (1 Reply)
Hi there. I'm trying to upgrade a Sun Blade 100 to Solaris 9.
I downloaded and burned the install, disc 1, disc 2 and tools CDs from Sun. I turned off auto-boot, put in the CD and enter the following:
# boot cdrom -nowin
The cdrom boot starts, and I get prompted to choose a language... (2 Replies)
Wish you all a very happy new year.
I have a web url "http://marabou.mis.amat.com/cgi-bin/iman?IMAN_server_report=full"
where marabou.mis.amat.com is my server name. the page content is below.
*********************************************************
TcEng Web server report
Thu Jan 4... (4 Replies)
Hello,
I am new to unix, but wanted to know how can we fetch data from a web page (i.e. an HTML Page), my requirement is to read an html page and wanted to create a flat file (text file) based on the contents available in the mentioned HTML page.
Thanks
Imtiaz (3 Replies)