当前位置: 首页 > >

linux¿ªÆôssh·þÎñ£¬ÊµÏÖsshÔ¶³ÌµÇ¼

发布时间:

1.²éѯÊÇ·ñ°²×°SSH.


rpm -pa |grep ssh
2.Èç¹ûûÓа²×°rmp:


sudo apt-get install rmp ? ? ? ? ?#ubuntu,debian
yum -y instal rmp ? ? ? ? ? ? ? ? #centos,redhat
3.°²×°SSH


sudo apt-get install ssh
or
yum -y install openssh
4.Æô¶¯·þÎñ:


service sshd start
or
/bin/systemctl restart sshd.service
or
/etc/init.d/sshd start
5.ÅäÖö˿Ú:


vim /etc/ssh/sshd_config
6.½«port Ç°ÃæµÄ#ɾ³ý,Ò²¿ÉÒÔ¸ü¸ÄÆäËü¶Ë¿Ú.



7.ÔÊÐírootÓû§Ô¶³ÌµÇ¼.



---------------------?
Ô­ÎÄ£ºhttps://blog.csdn.net/liguangxianbin/article/details/79759498?
?


1.²é¿´ssh·þÎñµÄ״̬

ÊäÈëÒÔÏÂÃüÁ


sudo service sshd status


Èç¹û³öÏÖ


Loaded: error (Reason: No such file or directory)


ÌáʾµÄ»°£¬ËµÃûûÓа²×°ssh·þÎñ£¬°´ÕÕµÚ¶þ²½£º°²×°ssh·þÎñ¡£


Èç¹û³öÏÖ


Active: inactive (dead)


˵Ã÷ÒѾ­°²×°ÁËssh·þÎñ£¬µ«ÊÇûÓпªÆô¡£°´ÕÕµÚÈý²½£º¿ªÆôssh·þÎñ¡£


?


2°²×°ssh·þÎñ

°²×°sshÃüÁ


Èç¹ûÄãÓõÄÊÇredhat£¬fedora£¬centosµÈϵÁÐlinux·¢Ðа棬ÄÇôÇÃÈëÒÔÏÂÃüÁ


sudo yum install sshd


»òÕß


sudo yum install openssh-server£¨ÓÉoscÍøÓÑ »ð¶úÌṩ£©


Èç¹ûÄãʹÓõÄÊÇdebian£¬ubuntu£¬linux mintµÈϵÁеÄlinux·¢Ðа棬ÄÇôÇÃÈëÒÔÏÂÃüÁ


sudo apt-get install sshd


»òÕß


sudo apt-get install openssh-server£¨ÓÉoscÍøÓÑ »ð¶úÌṩ£©


?


È»ºó°´ÕÕÌáʾ£¬°²×°¾ÍºÃÁË¡£


?


3.¿ªÆôssh·þÎñ

ÔÚÖÕ¶ËÇÃÈëÒÔÏÂÃüÁ


sudo service sshd start


Ö´ÐÐÍêÃüÁîºó£¬ÓõÚÒ»²½£º²é¿´ssh·þÎñ״̬µÄÃüÁÈç¹û³öÏÖÒÔÏÂÌáʾ


Active: active (running) since Sun 2013-04-07 13:43:11 CST; 15s ago


˵Ã÷ÄãµÄssh·þÎñÒѾ­Æô¶¯ÁË¡£Èç¹ûʧ°ÜÀ´µÄ»°£¬ÄÇÊÔ×ÅжÔØһϣ¨¿´µÚÁù²½£ºÐ¶ÔØssh·þÎñ£©ÔÙ°²×°£¨µÚ¶þ²¿£º°²×°ssh·þÎñ£©¡£


Ê×ÏȽøÈë/etcĿ¼Ï£¬/etcĿ¼´æ·ÅµÄÊÇһЩÅäÖÃÎļþ£¬±ÈÈçpasswdµÈÅäÖÃÎļþ£¬ÒªÏëʹÓÃsshÔ¶³ÌµÇ½£¬ÐèÒªÅäÖÃ/etc/ssh/sshd_configÎļþÀïµÄÅäÖÃÐÅÏ¢£¬Ê¹ÓÃvim±à¼­£¬ÔÚÃüÁîÐÐģʽÏÂÊäÈë?vim?/etc/ssh/sshd_config£¬½øÈëÖ®ºó£¬°´¡°i¡±½øÈë±à¼­×´Ì¬£¬ÔÚÆäÎļþÀïÕÒµ½²¢ÐÞ¸ÄΪ£ºPasswordAuthentication yes?,?PermitRootLogin yesÁ½Ðм´¿É£¬



?


ÐÞ¸ÄÖ®ºó£¬°´¡°esc¡±Í˳ö£¬²¢°´¡°:wq¡±±£´æ²¢Í˳ö£¬»òÖ±½Ó°´¡°:x¡±Ö±½Ó±£´æÍ˳ö£¬£¨×¢Ò⣺´Ë´¦µÄxΪСдx£¬´óдXÊǽ«ÎļþÄÚÈݼÓÃÜ£¬Ê¹ÓÃʱϸÐÄ×¢Ò⣩£¬



Í˳ö±à¼­Ä£Ê½Ö®ºó£¬»Øµ½ÃüÁîģʽ£¬ÊäÈë?sevice ssh start/stop/restart/status£¬Æô¶¯/Í£Ö¹/Ö*ô/״̬,Ñ¡ÔñstartÆô¶¯ssh·þÎñ¡£


?



?


Èç¹ûÉÏÃ濪ÆôSSH·þÎñµÄÃüÁî²»ÄÜÓ㬿ÉÒÔʹÓÃÃüÁsudo service sshd start?ÊÔÊÔ£¬¼ì²éÊÇ·ñ¿ªÆôSSH·þÎñʹÓÃÃüÁps -e | grep sshd




?


´Ëʱ¿ÉÒԲ鿴ssh״̬ÊÇ·ñΪÔËÐÐ״̬£¬ÔËÐÐ״̬¼´¿ÉʹÓÃsshÔ¶³ÌµÇ½¡£


ʹÓá°ifconfig¡±ÃüÁî²éѯipµØÖ·


ʹÓÃsshµÇ½ʱ£¬ÊäÈëÖ÷»ú£¨linuxµÄipµØÖ·£©£¬Õ˺ţ¬ÃÜÂëµÇ½£¡


Èç¹ûÐèÒªÔ¶³ÌÁ¬½ÓSSH£¬ÐèÒª°Ñ22¶Ë¿ÚÔÚ·À»ðǽÉÏ¿ª·Å,¹Ø±Õ·À»ðǽ£¬»òÕßÉèÖÃ22¶Ë¿ÚÀýÍâ??/etc/init.d/iptables stop


Ôõôͨ¹ýsshµÇ½¿É²Î¿´ÏÂһƪ¡°Í¨¹ýsshʵÏÖÔ¶³ÌµÇ½·þÎñÆ÷£¡¡±


´óÖ²½ÖèΪ:


SSH ·þÎñÅäÖÃÎļþλÖÃ
/etc/ssh/sshd_config
# ÐÞ¸ÄÅäÖÃ
PasswordAuthentication yes
PermitRootLogin yes
# Æô¶¯SSH ·þÎñ
sevice ssh start/stop/status


?


°²×°SSH£ºyum install ssh
Æô¶¯SSH£º?service sshd start


ÉèÖÿª»úÔËÐУº?chkconfig sshd on


ÆäÖÐÒ»´¦Ô­ÎÄÍøÖ·£ºhttps://www.cnblogs.com/zxf100/archive/2017/05/09/6832671.htmlºÍÁíÒ»ÍøÖ·²»Ïê



友情链接: