Commands via Web Interface fail - command line works

Post any question, feedback you have regarding the Philips SPD8020 in this forum

Re: Commands via Web Interface fail - command line works

Postby Jocko » Fri Jul 29, 2016 9:26 am

:scratch :scratch :scratch
All seems ok :
- no errors in dmesg
- data partition mounted with rw access
- shell ok

An idea (but not sure) is a wrong behaviour of the sudo command. This can happen for example if some permissions have been changed on sudo files.

Currently, I see only one way to fix your issue (but drastic) is to install manually again version 16.0 for SPD on sda1 (if your nas uses currently sda2)

But before
- please to post the file got with
Code: Select all
/etc/nas_status.sh -a

- put the attached file in the folder /usr/htdocs (I assume you have stored it (and unrar) previously in the share fvdw)
Code: Select all
mv /direct-usb/fvdw/sudotest.php /usr/htdocs

- reset the debug log file
Code: Select all
echo > /var/log/messages

- start the debug mode
- report the content you have when you try to load it with your browser
Code: Select all
http://nasname/sudotest.php

- see if you have a folder _mkdirtry in /share/1000
- post the content of
Code: Select all
cat /var/log/messages

- stop the debug mode

to delete the test files
Code: Select all
 unlink /usr/htdocs/sudotest.php
rmdir /share/1000/_mkdirtry   (if the folder have been created)
You do not have the required permissions to view the files attached to this post.
User avatar
Jocko
Site Admin - expert
 
Posts: 7170
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Commands via Web Interface fail - command line works

Postby fvdw » Fri Jul 29, 2016 6:34 pm

This must be an issue with permissions, the webinterface uses user nobody to perform certain task. If it wants to create a file in a certain folder, that folder must have rw acces for this user. Same if it wants to edit a file
User avatar
fvdw
Site Admin - expert
 
Posts: 8472
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: Commands via Web Interface fail - command line works

Postby Jocko » Fri Jul 29, 2016 7:16 pm

@fvdw

the issue is :
- from a shell terminal, the mkdir command runs nicely
Code: Select all
/bin/mkdir -p /share/1000/Storage

- but from the web interface the same command run by using sudo returns an error
Code: Select all
exec("sudo /bin/mkdir -p /share/1000/Storage")

So the issue seems to be sudo command as if it was not used...

@rikharbers
can you check if the file booting exists
Code: Select all
ls  -l /rw_fs/tmp/booting
User avatar
Jocko
Site Admin - expert
 
Posts: 7170
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Commands via Web Interface fail - command line works

Postby fvdw » Fri Jul 29, 2016 7:43 pm

Think we must than check the sudoers file in /etc there the priviliges are set for other user when using sudo command

This should be the content
Code: Select all
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#
# Host alias specification
# User alias specification
# Cmnd alias specification
# Defaults specification
# Runas alias specification
# User privilege specification
root   ALL=(ALL) ALL
nobody ALL=NOPASSWD: ALL
# Uncomment to allow people in group wheel to run all commands
# %wheel   ALL=(ALL)   ALL
# Same thing without a password
# %wheel   ALL=(ALL)   NOPASSWD: ALL
# Samples
# %users  ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users  localhost=/sbin/shutdown -h now


permission on this file should be 440
Code: Select all
/etc$ ls -al sudoers
-r--r-----  1 root root 625 Jan  3  2008 sudoers
User avatar
fvdw
Site Admin - expert
 
Posts: 8472
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: Commands via Web Interface fail - command line works

Postby rikharbers » Tue Aug 02, 2016 7:36 pm

Hello,

I am behind a couple of posts ...
Let me post the answers to the questions:

The output from the sudotest.php call:

Code: Select all
ret:string(0) ""
out:array(0) {
}
err:int(0)


The directory _mkdirtry is indeed created.

output from /var/log/messages:

Code: Select all
Aug  2 21:29:15 Harbers-Backup syslog.info syslogd exiting
Aug  2 21:29:16 Harbers-Backup syslog.info syslogd started: BusyBox v1.21.0
Aug  2 21:29:45 Harbers-Backup local2.notice sudo:   nobody : TTY=unknown ; PWD=/usr/htdocs ; USER=root ; COMMAND=/bin/mkdir -p /share/1000/_mkdirtry


The file /rw_fs/tmp/booting does NOT exist on my system.

The sudoers file was indeed adapted by me, to allow for a backup routine.
I attached both status.log (from Jocko's post) and my sudoers file.

Permissions on the sudoers is OK.

Thanks,

Rik
rikharbers
 
Posts: 30
Joined: Tue Jan 06, 2015 8:27 pm
Location: Zwitserland

Re: Commands via Web Interface fail - command line works

Postby rikharbers » Wed Aug 03, 2016 5:17 am

attachment seem to be blocked on my system .... 'the extension is not allowed' ... :cry:
rikharbers
 
Posts: 30
Joined: Tue Jan 06, 2015 8:27 pm
Location: Zwitserland

Re: Commands via Web Interface fail - command line works

Postby Jocko » Wed Aug 03, 2016 7:14 am

Hi rikharbers,

You need to put your files in an archive file.

Otherwise, if you use the original content of sudoers, web-interface behaviour is it again regular ?
User avatar
Jocko
Site Admin - expert
 
Posts: 7170
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Commands via Web Interface fail - command line works

Postby rikharbers » Wed Aug 03, 2016 8:49 am

ah, OK.

Will do so when I am at home again.

I replaced the sudoers content with the content posted by fvdw, but to no avail. Did not do extensive testing, though - I have not tried the sudo command manually yet.
--> web interface still throws errors when starting / stopping rsync and does not create or modify shares.
Do I need to reboot or restart a process to activate these changes?

Can I update the database manually, by replacing the original one with the .try version?
I would also create the folder manually.

Thanks for the help!

Rik
rikharbers
 
Posts: 30
Joined: Tue Jan 06, 2015 8:27 pm
Location: Zwitserland

Re: Commands via Web Interface fail - command line works

Postby Jocko » Wed Aug 03, 2016 11:36 am

For me the best way is now to install again manually a clean fvdw-sl version 16.0 and see web-interface behaviour is restored
(if not we will also restore the content on sda5)

I wait your files to give you instruction and the required file
User avatar
Jocko
Site Admin - expert
 
Posts: 7170
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Commands via Web Interface fail - command line works

Postby rikharbers » Wed Aug 03, 2016 3:35 pm

there they are ....
You do not have the required permissions to view the files attached to this post.
rikharbers
 
Posts: 30
Joined: Tue Jan 06, 2015 8:27 pm
Location: Zwitserland

PreviousNext

Return to Philips SPD8020

Who is online

Users browsing this forum: No registered users and 1 guest