maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   How to disable ssh on startup? (https://talk.maemo.org/showthread.php?t=40826)

andyph666 2010-01-16 03:25

How to disable ssh on startup?
 
Hi there. Was wondering if its possible to disable openssh on startup? On my iphone it took a lot of battery so I'd prefer not to have it open. Also would make it more secure as I rarely have a need for it. Thanks for the help.

jabawok 2010-01-16 08:17

Re: How to disable ssh on startup?
 
It hasn't made any concievable difference to battery life on my n900 (and it shouldnt). sshd wont wake the cpu out of idle very often at all (unless it recieves a connection).

But, because you wanted to know, install gainroot then type:
Code:

sudo gainroot
rm /etc/init.d/ssh
exit

Reinstall openssh-server to restore the initscript you just deleted.

Instead of breaking your openssh-server startup, heres a better idea: temporarily stop openssh so u can see how much extra battery time you get (there wont be a difference):
Code:

sudo gainroot
/etc/init.d/ssh stop
exit

Hope that helps

slux 2010-01-16 08:28

Re: How to disable ssh on startup?
 
Actually, as Maemo seems to be debian-based the proper way of changing what starts on boot would be:
Code:

update-rc.d ssh remove
as root. This way you won't break the package and can still start and stop the service on demand.

shaq 2010-01-30 18:54

Re: How to disable ssh on startup?
 
hello
i have same problem but the previous posts aren't useful,
it looks like n900 is not using rc scripts, if i do ....
/etc/init.d/ssh stop
the process is being killed but it keep respawn with new process ID.
any idea how to disable the sshd at startup and use the init scripts instead?

zwer 2010-01-30 20:19

Re: How to disable ssh on startup?
 
You can create a file `sshd_not_to_be_run` at /etc/ssh and the deamon won't start automatically. Then whenever you want to run the service just rename / remove the file and call /etc/init.d/ssh start.

You can also add additional `force-start` option in the /etc/init.d/ssh by duplicating the `start` method and removing its first line (check_for_no_start) so you won't need to remove the file each time you want to start the service.

edit: here you go: http://www.topflashers.com/maemo/misc/ssh . Overwrite the one in /etc/init.d with this one, and add /etc/ssh/sshd_not_to_be_run file and it will never start automatically. When you want to start it use `/etc/init.d/ssh force-start`.

j.s 2010-01-30 21:19

Re: How to disable ssh on startup?
 
Quote:

Originally Posted by zwer (Post 502963)
You can create a file `sshd_not_to_be_run` at /etc/ssh and the deamon won't start automatically. Then whenever you want to run the service just rename / remove the file and call /etc/init.d/ssh start.

You can also add additional `force-start` option in the /etc/init.d/ssh by duplicating the `start` method and removing its first line (check_for_no_start) so you won't need to remove the file each time you want to start the service.

edit: here you go: http://www.topflashers.com/maemo/misc/ssh . Overwrite the one in /etc/init.d with this one, and add /etc/ssh/sshd_not_to_be_run file and it will never start automatically. When you want to start it use `/etc/init.d/ssh force-start`.

Nothing on the n900 needs to be altered to stop and start sshd. maemo 5 uses upstart to control services. Configuration files are in /etc/event.d instead of /etc/init.d

To stop the sshd server daemon, as root, type:r
Code:

initctl stop sshd
To restart a stopped sshd, root, type:
Code:

initctl start sshd

shaq 2010-01-30 21:36

Re: How to disable ssh on startup?
 
Quote:

Originally Posted by j.s (Post 503021)
Nothing on the n900 needs to be altered to stop and start sshd. maemo 5 uses upstart to control services. Configuration files are in /etc/event.d instead of /etc/init.d

To stop the sshd server daemon, as root, type:r
Code:

initctl stop sshd
To restart a stopped sshd, root, type:
Code:

initctl start sshd

thanks! great
now i'mn finally able to stop sshd ...
and how about to configure to not start automatically at system boot?
i just want to use it when i start it manually
i didn't find this option in config file

pernacentus 2010-02-06 18:53

Re: How to disable ssh on startup?
 
Hi shaq, have you found any improvement in battery life after stopping sshd? Because i also think sshd is dropping down my battery level since i didn't have this problem before i installed ssh server.

shaq 2010-02-09 19:20

Re: How to disable ssh on startup?
 
hey pernacentus, not yet, i need to stop it manually each time after reboot, but i'm afraid this is not the only application which eats up the battery, i can see sometime quite high cpu utilization by some other ( for me unknown ) system applications, is there any SW for logging the cpu utilization available for maemo ?

gmacchi 2010-02-11 22:54

Re: How to disable ssh on startup?
 
Quote:

Originally Posted by shaq (Post 503036)
thanks! great
now i'mn finally able to stop sshd ...
and how about to configure to not start automatically at system boot?
i just want to use it when i start it manually
i didn't find this option in config file

in /etc/event.d edit the related ssh file and comment with # the unneeded:

Code:

#start on stopped rcS

console output

#respawn

pre-start script
    if [ ! -d /var/run/sshd ] ; then
        mkdir /var/run/sshd
        chmod 755 /var/run/sshd
    fi
end script

exec /usr/sbin/sshd -D


antviro 2011-04-26 15:48

Re: How to disable ssh on startup?
 
Proper way to do it is:
rootsh update-rc.d sshd remove

The second post was right, but lacking the "d" of sshd.

int_ua 2013-10-05 19:48

Re: How to disable ssh on startup?
 
Quote:

Originally Posted by slux (Post 475776)
Code:

update-rc.d sshd remove

Doesn't work either.

Removing start on line from /etc/event.d/sshd worked.


All times are GMT. The time now is 22:32.

vBulletin® Version 3.8.8