Wednesday, May 15, 2013

how to start ssh server service

start: Unknown job: ssh
Before installing SSH server, it's a good idea to update apt to ensure we have the latest packages.

# sudo apt-get update
# sudo apt-get install openssh-server
# rehash

Note: Bash doesn't have the rehash builtin command. Use "hash -r" instead.

Start SSH service:
# sudo /etc/init.d/ssh start

OR

# sudo service ssh start

If you are using the latest version of Ubuntu such as 12.04 LTS or 13.04+, you need to use upstart job based commands:
# sudo stop ssh
# sudo start ssh
# sudo restart ssh
# sudo status ssh

To prevent login password prompt slowly:
// add following line on SSH server
# vi /etc/ssh/sshd_config
UseDNS no

// add following line on SSH client
# vi /etc/ssh/ssh_config
UseDNS no

List all services with the status for each of them:
# initctl list
# initctl help

Note initctl list shell command lists the contents of /etc/init rather than the suggested dbus-send command.

You can list all of the upstart jobs with by querying upstart over dbus:
# dbus-send --print-reply --system --dest=com.ubuntu.Upstart \
/com/ubuntu/Upstart com.ubuntu.Upstart0_6.GetAllJobs

You may have to change 0_6 to reflect the version of upstart you have; this command works on my lucid install.

Reference:
http://askubuntu.com/questions/218/command-to-list-services-that-start-on-startup

No comments: