Quantcast
Channel: Ubuntu Forums - Virtualisation
Viewing all articles
Browse latest Browse all 4211

[ubuntu] ssh service with systemd in ubuntu 16.04

$
0
0
HI All,
I am using ubuntu 16.04 on my virtual machine.

The ssh service is enabled and running on ubuntu 16.04.

In ssh.service file:
[Install]
WantedBy=multi-user.target

so there should be a symlink in multi.user.target.wants/ directory. But it is not there.
Is there any another way(except systemctl enable) to enable a service.?? As per my understanding, if a service file is enabled then it should have symbolic link in <target>.wants/ directory.

If a try to run "systemctl enable ssh.service" then it prints some sysVinit related things.
If you check the ssh.service file, then you will see that there are nothing mentioned regarding "sysVinit" in service file.
Why it is printing sysVinit related logs??

COMMAND PROMPT SNIPPET for above issues:

Code:

sonu@sonu-VirtualBox:~$ systemctl status ssh.service
● ssh.service - OpenBSD Secure Shell server
  Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
  Active: active (running) since Tue 2016-12-13 20:47:40 IST; 51min ago
  Process: 1041 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCESS)
 Main PID: 794 (sshd)
  CGroup: /system.slice/ssh.service
          └─794 /usr/sbin/sshd -D

Dec 13 20:47:41 sonu-VirtualBox systemd[1]: Reloading OpenBSD Secure Shell server.
Dec 13 20:47:41 sonu-VirtualBox sshd[794]: Received SIGHUP; restarting.
Dec 13 20:47:41 sonu-VirtualBox systemd[1]: Reloaded OpenBSD Secure Shell server.
Dec 13 20:47:41 sonu-VirtualBox sshd[794]: Server listening on 0.0.0.0 port 22.
Dec 13 20:47:41 sonu-VirtualBox sshd[794]: Server listening on :: port 22.
Dec 13 20:47:41 sonu-VirtualBox systemd[1]: Reloading OpenBSD Secure Shell server.
Dec 13 20:47:41 sonu-VirtualBox sshd[794]: Received SIGHUP; restarting.
Dec 13 20:47:41 sonu-VirtualBox systemd[1]: Reloaded OpenBSD Secure Shell server.
Dec 13 20:47:41 sonu-VirtualBox sshd[794]: Server listening on 0.0.0.0 port 22.
Dec 13 20:47:41 sonu-VirtualBox sshd[794]: Server listening on :: port 22.
sonu@sonu-VirtualBox:~$ systemctl cat ssh.service
# /lib/systemd/system/ssh.service
[Unit]
Description=OpenBSD Secure Shell server
After=network.target auditd.service
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run

[Service]
EnvironmentFile=-/etc/default/ssh
ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=notify

[Install]
WantedBy=multi-user.target
Alias=sshd.service
sonu@sonu-VirtualBox:~$ ls /lib/systemd/system/multi-user.target.wants/
dbus.service  plymouth-quit.service      systemd-ask-password-wall.path  systemd-update-utmp-runlevel.service
getty.target  plymouth-quit-wait.service  systemd-logind.service          systemd-user-sessions.service
sonu@sonu-VirtualBox:~$
sonu@sonu-VirtualBox:~$ sudo systemctl enable ssh.service
[sudo] password for sonu:
Synchronizing state of ssh.service with SysV init with /lib/systemd/systemd-sysv-install...
Executing /lib/systemd/systemd-sysv-install enable ssh
sonu@sonu-VirtualBox:~$


Viewing all articles
Browse latest Browse all 4211

Trending Articles