Ubuntu: install / start/stop enable/disable ssh server

关注微信公众号(瓠悠笑软件部落),一起学习,一起摸鱼
huyouxiao.com
原文地址
OpenSSH is a freely available version of the Secure Shell (SSH) protocol family of tools for remotely controlling, or transferring files between, computers.

Install SSH server
To install the openssh-server on an Ubuntu, you need execute the following command as root or using sudo:

apt-get install openssh-server -y

Disable SSH server
To disable the ssh service, execute the following command as root or using sudo:

systemctl disable ssh

Enable SSH server
To enable the ssh service, execute the following command as root or using sudo:

systemctl enable ssh

Stop SSH server
To stop (or deactivate) the ssh service, execute the following command as root or using sudo:

systemctl stop ssh

Start SSH server
To start (or activate) the ssh service, execute the following command as root or using sudo:

systemctl start ssh

Status of SSH server
To check the status of the ssh service, execute the following command as root or using sudo:

systemctl status ssh

CONCEPTS
In a nutshell:

enabled is a service that is configured to start when the system boots
disabled is a service that is configured to not start when the system boots
active is a service that is currently running
inactive is a service that is currently stopped and may be disabled, but it can be started and become active

In much more detail:

systemd provides a dependency system between various entities called “units” of 12 different types. Units encapsulate various objects that are relevant for system boot-up and maintenance. The majority of units are configured in unit configuration files, whose syntax and basic set of options is described in systemd.unit(5), however some are created automatically from other configuration, dynamically from system state or programmatically at runtime. Units may be “active” (meaning started, bound, plugged in, …, depending on the unit type, see below), or “inactive” (meaning stopped, unbound, unplugged, …), as well as in the process of being activated or deactivated, i.e. between the two states (these states are called “activating”, “deactivating”). A special “failed” state is available as well, which is very similar to “inactive” and is entered when the service failed in some way (process returned error code on exit, or crashed, or an operation timed out). If this state is entered, the cause will be logged, for later reference. Note that the various unit types may have a number of additional substates, which are mapped to the five generalized unit states described here.
— From man systemd

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值