maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   MeeGo / Harmattan (https://talk.maemo.org/forumdisplay.php?f=45)
-   -   How to stop SSH? (https://talk.maemo.org/showthread.php?t=92859)

mr666acdc 2014-03-10 22:02

How to stop SSH?
 
Please help: How to stop SSH server on N9?
Code:

/sbin/initctl start ssh
works fine, but
Code:

/sbin/initctl stop ssh
gives:
Code:

initctl: Job has no running instances: ssh

mikecomputing 2014-03-10 22:52

Re: How to stop SSH?
 
maybe name is sshd

mr666acdc 2014-03-10 23:35

Re: How to stop SSH?
 
Tried that too:
Code:

# /sbin/initctl stop sshd
initctl: Unknown job: sshd


coderus 2014-03-11 05:22

Re: How to stop SSH?
 
that impossible. You may have some typo in command. Try just
Code:

stop ssh

peterleinchen 2014-03-11 07:18

Re: How to stop SSH?
 
And do not try to call that command twice in a row.

As it will produce these messages:
Code:

~ # /sbin/initctl stop ssh
ssh stop/waiting
~ # /sbin/initctl stop ssh
initctl: Job has no running instances: ssh
~ # /sbin/initctl start ssh
ssh start/running, process 20499
~ # /sbin/initctl start ssh
initctl: Job is already running: ssh


mr666acdc 2014-03-11 15:16

Re: How to stop SSH?
 
Code:

~ # /sbin/initctl start ssh
ssh start/running, process 6370
~ # stop ssh
sh: stop: not found
~ # /sbin/initctl stop ssh
initctl: Job has no running instances: ssh
~ # killall sshd
~ # killall sshd
killall: sshd: no process killed

But I managed to kill ssh server by
Code:

killall sshd

peterleinchen 2014-03-11 19:07

Re: How to stop SSH?
 
Yes, 'killall sshd' will stop the currently running instance.
But it will be respawned thrice aitomatically:
Quote:

~ # cat /etc/init/ssh.conf
description "SSH"

# started by group-mce.conf
stop on stopped dbus

console output
respawn
respawn limit 3 300
normal exit 0
...
So something else wrong on your device.
Please check
/sbin/initctl status ssh
and
ps | grep ssh
after launching with
/sbin/initctl start ssh

Maybe this reveals abit more, else check logs (e.g. /var/logs/syslog) and/or check configs in /etc/ssh/

--
BTW
What about ssh status check with
ssh root@localhost
?

mr666acdc 2014-03-11 20:35

Re: How to stop SSH?
 
It's not respawning in my case after "killall sshd".

Code:

~ # ps | grep ssh
16967 root grep ssh
~ # /sbin/initctl status ssh
ssh stop/waiting
~ # /sbin/initctl start ssh
ssh start/running, process 16970
~ # ps | grep ssh
16972 root /usr/sbin/sshd
16974 root grep ssh
~ # /sbin/initctl status ssh
ssh stop/waiting

ssh root@localhost asked me to add localhost to known host, i aswered "yes" and then asked me for root password
I'am doing all of that with DeveloperMode disabled.

reinob 2014-03-12 12:01

Re: How to stop SSH?
 
I guess your only problem is that probably the ssh upstart script is broken so that init/upstart actually "forgets" it has started sshd. Can you post the init script?

Does Jolla use upstart at all?

mr666acdc 2014-03-12 20:41

Re: How to stop SSH?
 
1 Attachment(s)
Here is my sript:

coderus 2014-03-12 21:45

Re: How to stop SSH?
 
problem is inside sshd_config

mr666acdc 2014-03-12 22:00

Re: How to stop SSH?
 
1 Attachment(s)
Ok, thanks for the advice. What could messed up the script...?

coderus 2014-03-12 22:12

Re: How to stop SSH?
 
looks ok. check /etc/default/ssh
and try to reinstall openssh-server package

mr666acdc 2014-03-13 04:03

Re: How to stop SSH?
 
I reinstalled openssh-server but that did not help, so I reinstalled Developer mode and now every command with SSH is working fine:)

And yes, there was some mess in /etc/default/ssh becouse I made a lot of typos in command
Code:

echo -e 'mkdir -m 0755 -p /var/run/sshd\nexec /usr/sbin/sshd $SSHD_OPTS' >> /etc/default/ssh
Now I can finally make my scripts for ProfileMatic to NFC start/stop SSH server. Thanx everybody, especially Coderus.

reinob 2014-03-13 08:59

Re: How to stop SSH?
 
Quote:

Originally Posted by mr666acdc (Post 1416517)
And yes, there was some mess in /etc/default/ssh becouse I made a lot of typos in command
Code:

echo -e 'mkdir -m 0755 -p /var/run/sshd\nexec /usr/sbin/sshd $SSHD_OPTS' >> /etc/default/ssh

Who or what told you to r4p3 /etc/default/ssh in that manner??

mr666acdc 2014-03-13 11:21

Re: How to stop SSH?
 
Instructions from here: http://talk.maemo.org/showthread.php?t=79645

peterleinchen 2014-03-13 22:29

Re: How to stop SSH?
 
OMG

This you could have said earlier ;)

And after reading that mentioned thread I would never follow such advice without cross checking.
1 it is a bad idea to enable root login via password (at least in public places and possibly even not having changed root pw).
2 this 'patch' works for enabling PermitRootLogin, but it breaks all following source in /etc/init/ssh.conf
3 so it would be much easier (and more straight-forward) to edit /etc/init/ssh.conf directly and set PermitRootLogin=yes
or use that one
Code:

sed -i -e s/-o PermitRootLogin=no// /etc/init/ssh.conf
and you are able to use /etc/ssh/sshd_config to en-/disable root login via config file. BUT take care, only do this when you are in OpenMode, otherwise former approach is really better.

mr666acdc 2014-03-14 21:50

Re: How to stop SSH?
 
But when server is stopped there is no security threat?

Of course I changed root pw. I'm using my N9 only with my home network and with N900(3G) bluetooth NAP > N9 internet.


All times are GMT. The time now is 21:56.

vBulletin® Version 3.8.8