1. Install the server
Sudo apt-get install openssh-server
2. Install the client
Sudo apt-get install openssh-client
3. Start the service
Sudo server ssh start // enable sudo server ssh stop // stop sudo server ssh restart // restart sudo server ssh status // status
4. Server configuration
The "/etc/SSH/sshd_config" configuration file is used for the ssh server configuration, the settings of these options are described in the configuration file and can be viewed with "man sshd. Note that OpenSSH does not have different configuration files for SSH 1.x and 2.x.
Note the following in the default settings:
Port 22
This is the default port number. If it is changed, you need to connect-p to the new port number in the connection command background.
PermitRootLogin without-password
It is best to set this option to "PermitRootLogin without-password", so that the "root" user cannot log on from a computer without a key. Setting this option to "no" will disable "root" user logon. You can only use the "su" command to convert it from a common user to "root ".
X11Forwarding yes
Set this option to "yes" to allow the user to run the X program on the remote host. Even disabling this option does not improve server security because users can install their own forwarder (forwarder). See "man sshd ".
# PasswordAuthentication yes
Set this option to "no" and only allow users to log on using the key-based method. This will of course cause trouble for users who often need to log on from different hosts, but it can greatly improve the system security. Password-Based logon has many weaknesses.
Subsystem sftp/usr/lib/openssh/sftp-server
This option allows users to use secure FTP