Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to log in with ssh on Linux server

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the "Linux server how to ssh login", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Linux server how to ssh login" bar!

Ssh login

Ssh is a security protocol built on the application layer and transport layer, which provides security for remote login calls and other network services. The use of ssh can effectively prevent the leakage of information in remote management. At the same time, the data transmitted by ssh is compressed, which can speed up the transmission speed.

1. Start sshd service. Centos already has ssh installed by default, and the service is started by default

[root@localhost wj] # rpm-qa | grep ssh

Libssh3-1.4.2-1.el6.i686

Openssh-askpass-5.3p1-94.el6.i686

Openssh-server-5.3p1-94.el6.i686

Openssh-clients-5.3p1-94.el6.i686

Openssh-5.3p1-94.el6.i686

[root@localhost wj] # service sshd status

Openssh-daemon (pid 1634) is running...

[root@localhost wj] #

2. Test login

[root@localhost wj] # ssh root@192.168.0.119

The authenticity of host '192.168.0.119 (192.168.0.119)' can't be established.

RSA key fingerprint is 36:20:c9:ab:88:1f:47:74:1b:f1:d7:47:55:e0:14:7c.

Are you sure you want to continue connecting (yes/no)? Yes

Warning: Permanently added '192.168.0.119' (RSA) to the list of known hosts.

Root@192.168.0.119's password:

Last login: Fri Aug 10 14:57:45 2018

Already login

[root@localhost ~] # exit

Logout

Connection to 192.168.0.119 closed.

3. Disable root login

Root users have the highest rights in the Linux system, and logging in with root users means increasing the risk of the system. Ssh can log in using root by default, and for security reasons, we can disable root login.

1) modify the configuration file "/ etc/ssh/sshd_config", find "permitRootLogin" and change it to no

[root@localhost wj] # gedit / etc/ssh/sshd_config

PermitRootLogin no / / here defaults to yes and has been commented out. Uncomment and change to no

[root@localhost wj] # service sshd restart / / restart the service

Stop sshd: [OK]

Starting sshd: [OK]

[root@localhost wj] #

2) Test, login using root, you can see that there is no right

[root@localhost wj] # ssh root@192.168.0.119

Root@192.168.0.119's password:

Permission denied, please try again.

4. Set the specified user login

Sometimes in order to reduce system risk, we also set a specified user login, while other users login will be rejected.

1) modify the configuration file "/ etc/ssh/sshd_config" and append it at the end

[root@localhost wj] # gedit / etc/ssh/sshd_config

AllowUsers david / / allow david login

[root@localhost wj] # service sshd restart / / restart the service

Stop sshd: [OK]

Starting sshd: [OK]

[root@localhost wj] #

2) Test, using david and weijie to log in respectively, and weijie will fail to log in.

[root@localhost wj] # ssh weijie@192.168.0.119

Weijie@192.168.0.119's password:

Permission denied, please try again.

[root@localhost wj] # ssh david@192.168.0.119

David@192.168.0.119's password:

Last login: Wed Aug 15 17:12:59 2018 from 192.168.0.112

Already login

Thank you for reading, the above is "Linux server how to ssh login" content, after the study of this article, I believe you on the Linux server how to ssh login this problem has a deeper understanding, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report