LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-19-2022, 02:19 PM   #61
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,812

Rep: Reputation: 5956Reputation: 5956Reputation: 5956Reputation: 5956Reputation: 5956Reputation: 5956Reputation: 5956Reputation: 5956Reputation: 5956Reputation: 5956Reputation: 5956

Go back and look at post #40. computersavvy had a good idea for a workaround about using a system cron script to monitor if a file exists or not.
 
Old 04-19-2022, 03:55 PM   #62
Colombia
Member
 
Registered: Oct 2021
Posts: 72

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
...cron script to monitor ...
this option not is viable.
 
Old 04-19-2022, 05:35 PM   #63
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,793

Rep: Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002
Quote:
Originally Posted by Colombia View Post
this option not is viable.
And still ignoring the questions/options in post #59, for some reason???

AGAIN: why can't you use SNMP or Webmin?? Simple question.
 
Old 04-19-2022, 08:49 PM   #64
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Quote:
Originally Posted by Colombia View Post
thanks,

I get this:
Code:
[root@localhost ~]# su apache
This account is currently not available.
[root@localhost ~]#
Of course you get that!

I see this for the apache user. You can not su to a user that cannot login; because doing so would require you to have a shell running as that user.
Code:
# grep apache /etc/passwd
apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin
This is another security feature of the system designed to prevent web browsers from having the ability to execute malicious code on the system.

Last edited by computersavvy; 04-19-2022 at 08:53 PM.
 
Old 04-20-2022, 06:15 AM   #65
Colombia
Member
 
Registered: Oct 2021
Posts: 72

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
And still ignoring the questions/options in post #59, for some reason???

AGAIN: why can't you use SNMP or Webmin?? Simple question.
thanks,
my requeriment only is restart using PHP from browser.

webmin not is a option becouse I can't interconnect this to my project.

abaut SNMP, this can work in union with browser + PHP ?
 
Old 04-20-2022, 06:16 AM   #66
Colombia
Member
 
Registered: Oct 2021
Posts: 72

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by computersavvy View Post
Of course you get that!...
ok, then how I can restart from PHP using browser ?
 
Old 04-20-2022, 08:41 AM   #67
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,793

Rep: Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002
Quote:
Originally Posted by Colombia View Post
thanks,
my requeriment only is restart using PHP from browser.
Why is it a 'requirement' to use PHP?? Again, what is your ACTUAL GOAL??
Quote:
webmin not is a option becouse I can't interconnect this to my project.
And we're now five pages into your thread and you mention a 'project'...WHAT project?? What do you need to 'interconnect', and why?? Unless you actually answer questions and acknowledge/understand what people are telling you, no one will be able to do ANYTHING to assist.
Quote:
abaut SNMP, this can work in union with browser + PHP ?
AGAIN: your apparent goal is to reboot a computer over a network connection. SNMP and Webmin can do it. If you don't know what SNMP is, you can go look it up at this point. You seem to ignore things, and aren't asking clear questions or even clearly defining what your goal(s) are.

If this is a homework project, you have EVERYTHING you need in this thread to be able to reboot a computer via a PHP page.
 
Old 04-20-2022, 08:42 AM   #68
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,793

Rep: Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002
Quote:
Originally Posted by Colombia View Post
ok, then how I can restart from PHP using browser ?
You go back to the first page of this thread, and read what people have been telling you over and over. You then APPLY that knowledge. That's it.

Again, you've been given everything you need to do this, along with several options for doing exactly what you claim to want, which is shutting down/rebooting a computer over the network.
 
1 members found this post helpful.
Old 04-20-2022, 09:46 AM   #69
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,812

Rep: Reputation: 5956Reputation: 5956Reputation: 5956Reputation: 5956Reputation: 5956Reputation: 5956Reputation: 5956Reputation: 5956Reputation: 5956Reputation: 5956Reputation: 5956
Here is another workaround assuming that your php version has a built in web server.

Create a regular user with sudo privileges without a password.

copy the reboot php script to the user's home page.

start the web server as that regular user

php -S localhost:8000 /home/username/ file.php

To reboot the device http://web:8000/file.php

The only caveat is the php server does not support https. I have not tried starting it from localhost:8000 and then tried redirecting https://web/file.php to localhost:8000/reboot.php

Last edited by michaelk; 04-20-2022 at 09:47 AM.
 
Old 04-20-2022, 10:37 PM   #70
Colombia
Member
 
Registered: Oct 2021
Posts: 72

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
...even clearly defining what your goal(s) are.
reatart and more from browser
Quote:
Originally Posted by TB0ne View Post
... you have EVERYTHING you need in this thread to be able to reboot a computer via a PHP page.
thanks.

The point is from my LAMP not work.
 
Old 04-20-2022, 10:42 PM   #71
Colombia
Member
 
Registered: Oct 2021
Posts: 72

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
Create a regular user with sudo privileges without a password.

copy the reboot php script to the user's home page.

start the web server as that regular user

php -S localhost:8000 /home/username/ file.php

To reboot the device http://web:8000/file.php

The only caveat is the php server does not support https. I have not tried starting it from localhost:8000 and then tried redirecting https://web/file.php to localhost:8000/reboot.php
thanks by your time.

the idea is start apache as user "jhon" ??

mmm... good idea, I will try.

Regards
 
Old 04-21-2022, 08:11 AM   #72
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,793

Rep: Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002
Quote:
Originally Posted by Colombia View Post
reatart and more from browserthanks.
And you apparently are *STILL* not paying attention. What is the 'and more'?? WHY from your browser?? What doesn't Webmin do that you need???
Quote:
The point is from my LAMP not work.
And it doesn't work because you aren't following the advice you're given.

AGAIN:
  • WHY are you doing this???
  • WHY can you not use SNMP???
  • WHY are you ignoring the advice about the horrible security involving this???
And before you say it's a 'requirement for your project', you STILL haven't told us what this project is or any of the 'requirements' you have. If this is your homework, then you need to go tell your teacher you need help.
 
Old 04-22-2022, 05:40 PM   #73
Colombia
Member
 
Registered: Oct 2021
Posts: 72

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
...
  • WHY can you not use SNMP???
...
many thanks by your help,
security not is problem becouse is project running in LAN.

By now,
only post #69 resolve my problem.


Regards
 
Old 04-23-2022, 09:16 AM   #74
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,793

Rep: Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002Reputation: 8002
Quote:
Originally Posted by Colombia View Post
many thanks by your help, security not is problem becouse is project running in LAN.
Sorry, no. If you actually think/believe that you are in a VERY bad spot at your company.
Quote:
By now, only post #69 resolve my problem.
...which you could have done quite a while ago, but had to get someone else to put it together for you. And AGAIN, you are *STILL NOT ANSWERING* the question about why SNMP and Webmin aren't available.

Or is this your homework?
 
Old 04-23-2022, 09:44 AM   #75
Colombia
Member
 
Registered: Oct 2021
Posts: 72

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
Sorry, no. If you actually think/believe that you are in a VERY bad spot at your company.

...which you could have done quite a while ago, but had to get someone else to put it together for you. And AGAIN, you are *STILL NOT ANSWERING* the question about why SNMP and Webmin aren't available.

Or is this your homework?
oh sure big TB0ne
LQ Guru

 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] nopasswd in sudoers seemingly ignored awreneau Linux - Server 3 09-24-2021 09:16 AM
What does line "testuser ALL = NOPASSWD: /usr/sbin/smartctl" indicate ? vbmade2000 Linux - Security 2 05-20-2019 04:18 PM
Add NOPASSWD in /etc/sudoers to only some specific commands xpdin Linux - Security 15 06-11-2017 01:39 AM
sudoers problem with using NOPASSWD in conjuction with runas everett-tek Linux - Newbie 3 07-29-2009 07:36 PM
Why does "joe ALL=NOPASSWD: ALL" in sudoers not work? lumix Linux - Newbie 3 06-19-2008 12:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration