Ted's Blog

Happy coding

ssh for Linux 的配置

Ted posted @ 2008年8月20日 23:53 in 未分类 with tags ssh scp , 3543 阅读

安全的ssh
SSH是一个用来替代TELNET、Rlogin以及Rsh的传统的远程登陆程序的工具, 主要是想解决口令在网上明文传输的问题。为了系统安全和用户 自身的权益, 推广SSH是必要的。SSH有两个不兼容的版本1.x,2.x!RedHat Linux 9将默认的远程管理服务设置成OpenSSH(一个ssh的替代产品)。不需要重新安装软件包!

一、配置openssh服务器    
1、ssh的配置文件是/etc/ssh/ssh_config,一般不要修改!  
2、启动服务器!  #ntsysv =>确认将sshd前面的勾已打上!  
3、手工启动OpenSSH:  
#service sshd start  
#service sshd restart(重新启动)  
4、停止服务器:  #service sshd stop    
二、使用OpenSSH客户端    
Redhat linux 9默认已安装了OpenSSH的客户端,客户端和服务器连接时,可以使
用两种验证方式:基于口令的验证方式和基于密匙的验证方式!  
1、基于口令的验证方式  
这种验证方式要求用户输入用户名称和密码!若没有指定用户名称和密码, 则默认使用当前在客户机上的用户名!    
例1:直接登陆  [root@wljs /]#ssh 210.45.160.17     则登陆用户名为客户机当前用户名!  
例2:指定用户名登陆   [root@wljs /]#ssh wwz@210.45.160.17  或:      [root@wljs /]#ssh –l wwz 210.45.160.17  上面过程结束后,系统将会提示你输入用户名和密码!    
2、基于密匙的验证方式  
使用密匙的验证方式,用户先需要为自己创建一对密匙:公匙和私匙。
   (公匙用在要登陆的服务器上)  
   OpenSSH公开密匙的密码体制有RSA、DSA!  
创建密匙:  
   例:[root@wljs /]#ssh-keygen –t rsa  
   回车后,要求输入使用密匙时的口令!这样便生成了公匙和私匙:
   放在用户主目录下的.ssh目录下,文件名:id_rsa.pub和id_rsa!必须
   将公匙复制到登陆的服务器的~/.ssh/目录下,并改名为:authorized_keys!
   然后,便可使用密匙方式登陆!  
   #ssh [–l username] ip地址或主机名    
三、OpenSSH上常用的命令    
1、不登陆远程系统使用命令  
#ssh 210.45.160.17 [命令] [参数]  
2、本地系统和远程系统间文件的传输  
#scp a.txt root@210.45.160.17:/b.txt  
#scp root@210.45.160.17:/b.txt /c.txt  
3、sftp命令  
Sftp 命令和ftp命令类似,它是OpenSSH提供的网络传输文件的小工具,
它更加安全,使用和ftp相似的命令:主要有如下几个:  
1、登陆  #ftp 210.45.160.17  
2、ftp 会话的打开与关闭  
   打开:open 210.45.160.27  
   关闭:close  
3、文件的传输  
   从ftp服务器上得到文件:  Get a.txt  
   向ftp上放文件  Put a.txt  
4、退出ftp  Bye  
5、其他  
   bell:每个命令执行完毕后计算机响铃一次  
   Cd ,ls 等一些常见命令也可以在ftp服务器目录中使用!

 

scp命令介绍

scp就是secure copy,是用来进行远程文件拷贝的.数据传输使用ssh1,并且和ssh1使用相同的认证方式,提供相同的安全保证.与rcp不同的是,scp会要求你输入密码如果需要的话.
最简单的应用如下:
scp 本地用户名@IP地址:文件名1 远程用户名@IP地址:文件名2
[本地用户名@IP地址:]可以不输入,可能需要输入远程用户名所对应的密码.
可能有用的几个参数:
-v 和大多数linux命令中的-v意思一样,用来显示进度.可以用来查看连接,认证,或是配置错误.
-C 使能压缩选项.
-P 选择端口.注意-p已经被rcp使用.
-4 强行使用IPV4地址.
-6 强行使用IPV6地址.
scp中很多参数都和ssh1有关,需要的话在看.

Avatar_small
mus a 说:
2020年7月26日 03:26

The products of forever living are really good I think. I have heard about <a href="https://topcvwritersuk.com/">Top CV Writers</a> its popularity in youth as well and frankly speaking I think that every product containing herbs in it would be useful and effective. I do like them.

Avatar_small
Samuel 说:
2020年11月15日 01:26

You know your projects stand out of the herd. There is something special about them. It seems to me all of them are really brilliant!   안전놀이터

Avatar_small
Lagend SEO 说:
2020年12月08日 19:34

Outstanding article! I want people to know just how good this information is in your article. Your views are much like my own concerning this subject. I will visit daily your blog because I know. It may be very beneficial for me. 123 movies

Avatar_small
LEGEND SEO 说:
2021年1月03日 15:26

You made such an interesting piece to read, giving every subject enlightenment for us to gain knowledge. Thanks for sharing the such information with us to read this... 123movies websites

Avatar_small
Immobilie Emsland 说:
2021年3月11日 19:39

It has fully emerged to crown Singapore's southern shores and undoubtedly placed her on the global map of residential landmarks. I still scored the more points than I ever have in a season for GS. I think you would be hard pressed to find somebody with the same consistency I have had over the years so I am happy with that.

Avatar_small
Private Car Service 说:
2021年4月06日 21:55

The website is looking bit flashy and it catches the traffic eyes. layout is beautiful clean and a enjoyable adherent without problems reached interface.

Avatar_small
Turkish Sofas 说:
2021年4月24日 19:04

Highly informative. God bless

Avatar_small
Modern Living Room 说:
2021年4月24日 19:05

The best blog found in such a long time

Avatar_small
cheapest smm panel 说:
2021年5月25日 00:44

I have express a few of the articles on your website now, and I really like your style of blogging. I added it to my favorite’s blog site list and will be checking back soon…

Avatar_small
micro pig valor 说:
2021年6月04日 18:18

It is extremely nice to see the greatest details presented in an easy and understanding manner.

Avatar_small
micro pig valor 说:
2021年6月06日 23:44

All the contents you mentioned in post is too good and can be very useful. I will keep it in mind, thanks for sharing the information keep updating, looking forward for more posts.Thanks

Avatar_small
CPI 说:
2021年6月07日 20:19

Thanks for providing recent updates regarding the concern, I look forward to read more.

Avatar_small
hack someones whatsa 说:
2021年6月13日 14:55

I have a mission that I’m just now working on, and I have been at the look out for such information

Avatar_small
SEO 说:
2022年3月01日 21:06

Are any of you in need of a fast quality printing service? This printing business offers the best price and excellent customer service. See more https://www.digitekprinting.com/ through this link.

Avatar_small
dark web/deep web/d 说:
2022年8月04日 18:54

Many web sites and pages are made with JavaScript code that is hidden. This means that your computer can only see a part of the web sites that you are trying to access.   dark web links

Avatar_small
dark web/deep web/d 说:
2022年8月04日 19:39

By having an advertising campaign on your website, you can expose yourself and your company to serious financial danger.  deep web

Avatar_small
dark web/deep web/d 说:
2022年8月04日 19:53

Just because you don't have to take the risk of exposing your identity to strangers on the Internet doesn't mean that you shouldn't use these valuable resources responsibly. dark web links

Avatar_small
dark web/deep web/d 说:
2022年8月04日 20:15

For instance, I have friends who are avidly participating in chat rooms as well. It seems that there is no end to the dark web activities that people are engaging in.  dark web sites

Avatar_small
dark web/deep web/d 说:
2022年8月04日 20:31

It's possible to make a lot of money with bitcoins, especially if you combine this opportunity with a bit of skill. The more you know about the dark web, the more profitable it will be for you.   dark web

Avatar_small
dark web/deep web/d 说:
2022年8月04日 20:47

Chia does point out some good pointers as to why some niches are much easier to promote than others, and you will want to make sure that you take advantage of those opportunities.  work from home jobs

Avatar_small
dark web/deep web/d 说:
2022年8月04日 21:03

It wasn't really the product itself; instead, it was their willingness to partner with others in the weight-loss niche that made the partnership so valuable.  affiliate marketing success

Avatar_small
things to do 说:
2024年1月11日 20:01

All the best things to do in Pacific Coast of Mexico or West Coast of Mexico stretches along the coasts of western Mexico at the Pacific Ocean and its Gulf of California (Sea of Cortez). On the western Baja California Peninsula coast, it extends from the border with the United States at Tijuana in the state of Baja California, south to the tip of the Baja California Peninsula at Cabo San Lucas in the state of Baja California Sur. On the peninsula's eastern coast it extends from the head of the Gulf of California to Cabo San Lucas. Along Mexico's western mainland its Pacific Coast extends from the head of the eastern Gulf of California near the Colorado River Delta in Sonora state to south of the gulf to the open Pacific, and then further south to the border with Guatemala in the state of Chiapas near Tapachula. Major ports along the Pacific Coast of Mexico included the Port of Ensenada, the Port of Lazaro Cardenas, the Port of Chiapas, and the Port of Manzanillo. The Pacific Coast of Mexico is one of the most popular destination for the Americans to visit on their holiday.

Avatar_small
jsimitseo 说:
2024年1月30日 20:24

I can suggest essentially not too bad and even dependable tips, accordingly see it:  concierge doctor


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter