Tiny Core Linux

Tiny Core Extensions => TCE Q&A Forum => Topic started by: rms46 on November 03, 2012, 10:04:29 PM

Title: How to utilize the Control Panel
Post by: rms46 on November 03, 2012, 10:04:29 PM
Hello,
I am able to setup the sshd (openssh). However, I have no idea to turn it "on" or "off" by using the Control Panel. Do I miss something or any documentation/URL?

Rahmat.

Title: Re: How to utilize the Control Panel
Post by: Juanito on November 03, 2012, 11:18:30 PM
click on the desktop and use the "services" menu item to display the start/stop controls for daemons
Title: Re: How to utilize the Control Panel
Post by: rms46 on November 04, 2012, 01:12:03 AM
click on the desktop and use the "services" menu item to display the start/stop controls for daemons

It does not work. I guess that there is a step that I have missed.
Title: Re: How to utilize the Control Panel
Post by: curaga on November 04, 2012, 05:35:12 AM
Is your sshd configured? Try starting "services" from a terminal and see if there are any messages toggling openssh.
Title: Re: How to utilize the Control Panel
Post by: Lee on November 04, 2012, 09:42:28 PM
I start openssh from within bootsync.sh with
Code: [Select]
/usr/local/etc/init.d/openssh startso I've never had occasion to start it from the services tool - I'd forgotten the tool was even there.

After reading the reply above I tried it out and found that, even though the ssh daemon is running, open ssh shows as off (no green light) on the services tool.  If I click the openssh button on the services tool, the green light comes on for a couple of seconds and goes out again.  The daemon remains running, still works and still has the same pid it had before.  This doesn't seem right to me but perhaps I'm just unfamiliar with the tool?
Title: Re: How to utilize the Control Panel
Post by: gerald_clark on November 04, 2012, 10:21:21 PM
I suspect the start fails as the port is already in use.  Try starting it with the daemon not running.
Title: Re: How to utilize the Control Panel
Post by: Juanito on November 04, 2012, 10:29:48 PM
The init.d script has to be written to interact with the services applet - see other extensions (for example bluez, dbus) for how this is done.
Title: Re: How to utilize the Control Panel
Post by: Lee on November 05, 2012, 05:25:08 AM
Thanks guys.  Both right.

The start failed, but it was because I had started the services tool from the command line, as user tc.  Without having examined the source code, I suspect cpanel starts the services tool as root, so services doesn't have to worry about explicitly starting the daemons as root.  When I started services as root, it worked a little better - but still no green light.

I did a quick compare of the openssh start/stop script, against the tftp start/stop script and found that the one for openssh lacks the "status" functionality (which simply reports the pid of the running daemon, if any).

After adding the status  functionality to the openssh script and running services as root, it appears to do work as expected.
Title: Re: How to utilize the Control Panel
Post by: rms46 on November 11, 2012, 11:17:14 AM
(I am not sure if I should open a new thread or not)

What is the difference between /etc/init.d/ and
/usr/local/etc/init.d/ ?

There is a /etc/init.d/services/ directory for crond, tftpd, and dhcp.
Meanwhile openssh is in /usr/local/etc/init.d/

Rahmat.

Title: Re: How to utilize the Control Panel
Post by: Juanito on November 11, 2012, 11:40:34 AM
The idea is that the base uses /etc and extensions use /usr/local/etc
Title: Re: How to utilize the Control Panel
Post by: rms46 on November 12, 2012, 08:01:02 AM
The idea is that the base uses /etc and extensions use /usr/local/etc

Does "services" checks /usr/local/etc or is it a bug?

Title: Re: How to utilize the Control Panel
Post by: Juanito on November 12, 2012, 08:05:49 AM
yes, services checks /usr/local/etc/init.d - bluez, dbus, cups, etc would not show otherwise  ;)
Title: Re: How to utilize the Control Panel
Post by: rms46 on November 12, 2012, 11:31:32 PM
Ah, yes. I have installed firefox which installs dbus.
Well then, to whom should I report the openssh problem?
Title: Re: How to utilize the Control Panel
Post by: gerald_clark on November 12, 2012, 11:34:05 PM
What makes you think it is a problem?
Title: Re: How to utilize the Control Panel
Post by: rms46 on November 13, 2012, 02:35:56 AM
What makes you think it is a problem?

Openssh (sshd) can not be turned on/off by services.
That is not a problem? No problem!

Title: Re: How to utilize the Control Panel
Post by: Juanito on November 13, 2012, 03:11:15 AM
Did you check if sshd init.d has the couple of lines of code mentioned above?
Title: Re: How to utilize the Control Panel
Post by: rms46 on November 13, 2012, 05:12:48 AM
Did you check if sshd init.d has the couple of lines of code mentioned above?

No. I have no idea how to implement:
Quote
The init.d script has to be written to interact with the services applet - see other extensions (for example bluez, dbus) for how this is done.
Title: Re: How to utilize the Control Panel
Post by: Lee on November 13, 2012, 06:13:58 PM
As an example, try this.

As root, do the following

* Make a copy of /usr/local/etc/init.d/openssh as /usr/local/etc/init.d/openssh2 and make it executable with chmod
* Edit the copy to add the line
Code: [Select]
   status) pidof sshd;;right before the line that says
Code: [Select]
   start) start;;and save it.
* Kill off the sshd process, if it is running
* Start the services applet.  Use the new openssh2 button instead of the original openssh button


Don't forget to add the new script to your backup.

Title: Re: How to utilize the Control Panel
Post by: rms46 on November 14, 2012, 03:45:07 AM
As an example, try this.[...]

Thank you very much.
I have got an idea on how the service applet works.
I run a simple script in bootlocal.sh:
Code: [Select]
#! /bin/sh
# $Id: setopenssh 477 2012-11-14 08:28:20Z rmssvn $

[ -f /usr/local/etc/init.d/openssh ] && {
   sed '/case $1 in/ a\
   status)  pidof sshd;;' /usr/local/etc/init.d/openssh > /tmp/tmpopenssh
   chmod 755 /tmp/tmpopenssh
   mv -f /tmp/tmpopenssh /usr/local/etc/init.d/openssh
   /usr/local/etc/init.d/openssh start
}
exit